Macro For Document
Feb 8, 2010i need macro for my document.this macro need run on column "E" & "H" i need like this.
ex- E2 cell some text or number is there,H2 cell value should delete.E2 cell is empty H2 value no need to delete.
i need macro for my document.this macro need run on column "E" & "H" i need like this.
ex- E2 cell some text or number is there,H2 cell value should delete.E2 cell is empty H2 value no need to delete.
I am processing a fair few Invoices, which are being sent to me via e-mail as excel documents, very often they contain mistakes, a decent amount of mistakes. Usually the prices are wrong.
I keep track of every single entry on the invoice on my own document - Tracker, which I consider to be the superior/more correct document to the Invoice presented to me by my contractor.
Both of the documents have a reference number, which is a specific docket number, and horizontally, in the invoice, there is going to be a price for this docket. In my document, there is going to be a separate column for the total price.
Is it possible (I guess with VBA) to check for mistakes in the Invoice, but use the Tracker as a reference for this check.
Tracker has
columns
A - Name
B - Department
C - Date
D - Docket No.
C - Total price for the docket (calculation of E to Z)
E to Z - all smaller entries
Invoice has
columns
A - Date
B - Docket No.
C to E price for that docket, but it is spread, because departments are separated out, so each VAT account can be charged accordingly. I guess it is possible to do a separate column for the price, if it is easier to do a script that way.
Basically, I need to check if in the Invoice document, the price (C to E) for Docket No. (B) is the same as the price (C) for the Docket No. (D) in the Tracker.
I would like the wrong entries to be highlighted on the Invoice Document, so I can see straight away, that this needs attention.
Not always the price is wrong, sometimes the Docket No. is spelled incorrectly (Dyslexic contractor), hence the highlighting.
I need a script that will turn a excel doc into a txt doc. Thats the easy part. The hard part (at least I think it is), is I need it to be in a certain format and I'll do my best to explain that fomat below.
View 9 Replies View RelatedI am recording a macro to help me with formatting a document. I know do this manually, but realized that if I record a macro and run it the process would be faster. I have tried this and it works really well. However the problem is that although the columns are always the same, the rows increase and decrease everytime I download the raw report.
When I record the macro and then run it, it only selects the number of rows that I choose when I record the macro. I am sure there is a way to have the macro look for date and then stop after there is no more rows, but I can't find it in help.
I have tried selecting the whole document, but that slows the automated formatting down significantly.
I need a macro for printing a document, Could anyone supply me with the macro. And how to acivate it and sve in the sheet
View 5 Replies View RelatedI have been having a problem with a document which I have created as a xlt format which then is saved locally but because some users arent as computer literate I have found them saving the document in non macro enabled format which means all macros are removed causing me a huge issue. Is there a macro which will only allow the document to be saved as macro enabled?
View 2 Replies View RelatedI have this macro currently running on an original excel document
Private Sub Workbook_Open()Dim fname
fname = "C:ackupEconomics Tracker - " & Format(Now, "dd mmm yy hh mm AM/PM") & ".xlsm"
ThisWorkbook.SaveCopyAs Filename:=fname
Sheets("Menu").Activate
End Sub
Which creates a backup of the document each time the document is opened; I was wondering, is it possible to remove that particular macro from the backup as opposed to saving the backup as .xlsx? I don't want to be able to open a backup and the backup makes a backup
That particular macro is running on the main workbook.
got a great bit of code the other day from this forum to automatically print 'x' amount of copies based on the value in cell (see below)
View 2 Replies View RelatedI have a list of regions in coloumn a) i need a macro that will create a new sheet within the excel document , and copy the entire row of data to the new sheet.
but it only creates a new sheet (named incidently the same as the region name) for different region names ?
ie.
australia data data data data data data data data
australia data data data data data data data data
USA data data data data data data data data
USA data data data data data data data data
USA data data data data data data data data
USA data data data data data data data data
France data data data data data data data data
for the above info there would only be 3 new sheets created within document .
I am basically using a combobox in word that opens an excel spreadsheet and pulls information about the people entered in the combobox. The information pulled from excel is then pasted into the original word document.
The problem that I am having is that the macro may be needed to run twice (ex. suppose the user forgot to include an individual in the first run) and on the second run the excel document cannot be opened and it gets stuck on the loop. The macro will only work again if the word document is closed and reopend. I suspect that the excel document is not completly closing on the first runthrough.
I've included my code below. The initialize combobox code is on the bottom. I
PHP Code:
Dim WordApp As Word.ApplicationDim xlApp As Excel.Application
'Dim xlWB As Excel.WorkbookPrivate Sub CommandButton1_Click()Bios
= ActiveWorkbook.NameNewWBookName
= ActiveWindow.CaptionSet WrdDoc
= ActiveDocumentlastrow = Range("A1").End(xlDown).RowS
[Code]....
I have this macro that works perfectly. My boss wanted the subtotal lines within the report to be in a smaller font, so I added lines to the macro to do that. It won't work with those lines in there! It says the reference is not valid on the red line in the code below. The 2 blue sections are the ones I added to change the font size.
Code:
'Add subtotals at the end of each age bucket
For i = 10 To LR Step 1
fr = Range("E" & i - 3).End(xlUp).Row
If Range("B" & i).Value = "Totals" Then
Range("E" & i).Formula = "=SUBTOTAL(9,E" & fr & ":E" & i - 2 & ")"
With Range("E" & i & ":R" & i).FillRight
[code].....
Why would the font size make a difference? Is there some other way to change the font size that would work better?
I want to set up a one step button in an Excel workbook to open up a Word Mailmerge Document that I have already set up complete with Excel data source. I have used this code so far but it's not working. What else do I have to do?
Sub OpenWordMailmergeMasterB()
Set appWD = CreateObject("Word.Application")
appWD.Visible = True
appWD.Documents.Open Filename:="X:Detention filesMail MergeLesley's MailmergeMASTER Interim Report.doc"
'To Run the Mail Merge
'Data source is a range name in Excel workbook called "MailmergeReport":.....................
how to put together a macro for a command button that deletes rows with certain text in a docyment - which worked fine a week or so ago - but now the macro will not work.
I made changes to the document - but made sure i also made changes to the code.
Currently I am going back and forth between an excel document and a word document cutting and pasting values from the excel spreadsheet into tables in word. The task is a regular occurance therefore I wish to create a Macro that can automate this procedure. Both the excel and word documents are fixed templates therefore once a Macro is created it can be applied to all future work of similar nature.
Each table in the word document contains 6 rows of values in a single column. The excel data is arranged in a table that is 6 rows by x number of columns (how ever many sets of values there are for the particular job) therefore x determines how many tables must exist in the word document. I move between the excel and word document cutting and pasting each column into each table. This is not so time consuming if x=10 however on occasion x=100+ and it does take time.
I use an excel workbook that contains around 20-30 output tables/ranges and i would to have a macro which will enable me to open a specific word document and paste these tables/ranges from excel into the word document. I am unsure as to how to get excel and word to "talk to each other"???
To make things more difficult i would like to be able to set the paste location in the word document, and ideally i would the copy and paste function to be a normal copy and paste and not a paste special as the tables/rnage in excel have already been formatted correctly and column widths adjusted to fit the margin of the word document.
Currently I select the range in excel, switch to word and paste then continue until all tables/ranges are pasted. Not difficult but as certain calculations change these tables/ranges need to be re-copied and pasted to word which gets frustrating.
I have a macro set up in Excel that formats and deletes rows matching a citeria. Once the macro runs I then manually copy the data across into Word. I would like to automate this.
I would like the macro to copy over any cells containing data iinto a new word document. I also have standard text that I would like to include at the beginning and end of the word document. With the excel data being placed in the centre.
I have searched the web and tried a couple of macros with no luck. All the macros state "' requires a reference to the Word Object library: ' in the VBE select Tools, References and check the Microsoft Word X.X object library"
I am unsure how to reference this - but I have checked and found that the object library ticked is Microsoft Word 11.0 Object Library.
All I want is to generate a word document with built in word header and footer (header and footer style name is "alphabet") based on the values which i mention in excel(path,word file name and header content.
View 1 Replies View RelatedI am my excel worksheet (excel 2010) I have one cell that changes every day (number). I want this number to open my htm document and replace the same number in a string in the htm and save/close this.
An example:
My htm document is located at C:/ and named XX.htm
The number I want from excel is in cell A1 in sheet1, and the worksheet is located in D:/ named yy.xlsx
And the text(number) I want to replace is in the following string in the htm document, in this string it is 72, next day it can be 30:
src="Bilder/72.png"
I have an excel document with a list of about 12,000 names/addresses. They are currently displayed like this:
A B C
1 <name1> <name2> <name3>
2 <address1> <address2> <address3>
3 <zip1> <zip2> <zip3>
...and I want to re-arrange them so they are displayed horizontally:
A B C
1 <name1> <address1> <zip1>
2 <name2> <address2> <zip2>
3 <name3> <address3> <zip3>
Is there any possible way of doing this quickly without copying/pasting 12,000 lines of text?
I am trying to sort a document alphabetically but cannot. I have two lines in the doc that previously had headers on them. I was able to remove them, but am now left with a row that has what looks like a backwards L in the last cell. The bottom line is also darker, but there is not a detectable border set. If I choose the rows that include these rows in my sort option, it is disabled. Sorting is available if I do not. I need to sort everything.
View 3 Replies View RelatedI have an excel document that is a form.
Can I use the data collected from this form to generate another new document?
I want the user to enter some data and hit "Create" and a new excel document with that data is created.
Also, the new document has some data in it already. So it has some data and it will get new data from the form.
Is there a way that I can have an excel document "autosave"?
Specificaly I would like: If a value in a specific cell's value is changed I would like the document to automatically save the document as the name of the value that is typed into that cell when the user closes the document.
I'm not sure if this is possible, but it would be great if there was some way to do this.
Version used: Excel 2003
I have a spreadsheet that everyone in my department uses. My boss has asked me to protect certain columns so that only I can edit them but leave others so that the rest of the depratment can use those.
I have tried locking the ones I am to use and unlocking the ones the others can use then protecting the document. This works well enough as far as it goes, however, it is combersome having to unprotect then reprotect it every time I need to work on it. Also, that method makes the drop down lists that we are using for easy sorting no longer function.
I am currently building a program in Excel, which can carry out numerious tasks. Having over 15 userforms, countless macros and several worksheets of caculations in the background, basically all geared towards capturing customer data, producing a application form and submitting the data to an ".mdb" file.
Now everything is going well so far with little in the way of problems and the document is 2.5Mb in size (users centrally access this Read Only). I'm conducting a daily Clean Project on this but I have a few questions...
1) how far can I push an Excel workbook in terms of size/content before it becomes unstable
2) are there any tips that can be offered for program stability
3) Has anyone built anything on this scale before
...the reason I ask is the program could potentially double in size over the next 6 months depending on the volume of application types it is able to produce. I want to make sure I have considered stability.
I was able to create a recordset of data and then save the recordset as an XML document. This XML document is aggregated data for a chart in Excel.
I need to hit the XML with ADO into a recordset from my select statement...
As you can see below, I think I found the Driver I need to use??? I am not sure that this is correct for Excel VBA ADO???
sSQL = "Select * From C:ADO.XML"
When I open the recordset.open sSQL, cnDB the error I get is this:
"The filename, directory name, or volumne label syntax is incorrect"
Set GetXMLDB = New ADODB.Connection
With GetXMLDB
.Open "Provider=MSDAOSP; Data Source=MSXML2.DSOControl.2.6;"
.CursorLocation = adUseClient
End With
I have an excel worksheet which has a lot of comments attached to individual cells. Is there a way to convert these comments into a microsft word document along with the contents of the cells to identify where they originated? Also Is it possible to convert just a selection of cells into word document rather than the whole worksheet.
Is there a way to list the recent changes to an excel document on the document itself?
For example, I have just 4 or 5 columns in the sheet, but out the the right on the 7th column I'll have a header that says "Recent Changes". Below that for X amount of rows, I would like it to keep a running change list something like this:
B14 was changed from '6.021' to '6.5' by username on 10/21/07 3:45 pm
A23 was changed from 'Sally' to 'Billy' by username on 10/21/07 2:30 pm
I thought this up by looking at the way the "Track Changes" functionality works on the Tools menu. That will highlight the cells in blue as they are changed and will also let someone look back through changes to let them accept or deny.
I've got an Excel document that is generated from a third party programme (See ExcelDoc attached)
I'm trying to manipulate it so that a macro creates a CSV file like the one attached (see THK.csv)
I need to have the following columns in the CSV file populated using the Excel spreadsheet
Column A: Will need to have the NUMBER that is in cell B2 of the Excel file in this case the number is 0714 (need to keep the preceeding 0 too)
Column B: Will need the phone number
Column C: Will need the fax number
Column D: Will need to have the email address
Column E: Will need to have the date only
Column F: Will need to have the Order Number
Column G: Will need to have the Customer name
Column H: Will need to have the Customer telephone number
Column I: Will need to have the Customer alternative telephone number
**Column J: Will need to have the 1st line of the address (after First Address in xls doc)
Column K: Will need to have the 2nd line of the address
Column L: Will need to have the 3rd line of the address
Column M: Will need to have the 4th line of the address
Column N: Will need to be a blank cell
Column O: Will need to be a blank cell
Column P: Will need to be a blank cell
Column Q: Will need to be a blank cell
Column R: Will need to be a blank cell
Column S: Will need to be populated with the information that is after the field MyAddress: in Cell B11 of the xls document.
I've managed to get a macro that will take the information and transpose it into a new document and rename it as an CSV file but I am having a lot of problems trying to get the macro to create the CSV file in the format that I need.
**This cell is generated and will have commas at the end of each line of the address and will be terminated by a period (at line 4 of the address. Sometimes there will be 4 lines to an address but sometimes there may only be 2 or three. In the case where there is no information I need to have a blank (null) value in the cell
I'm trying to open a word document from excel using VBA. Here is my code.
View 5 Replies View RelatedI'm using the following code to copy columns of data in a worksheet of mine. The code once activated will open "notepad" and copy the columns of data in my excel worksheet. Here is the
View 6 Replies View Related