Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro - Search one book, replace with data from another
I've exhausted my capabilities after hours of searching through threads.
I've done what I can, but am humbly seeking the advice of the experts. I'm not very good with VBA and survive by copying tid-bits that I see in other threads. I'm developing an invoicing system which is comprised of two separate workbookss: 1) Invoice Template 2) Invoice Listing The Invoice template contains a lookup formula to the Invoice Listing to get the next available invoice number. It also contains code to Paste that Invoice # as values, then copy an entire row of signficant invoice data (Row 2 of Summary Sheet) to the Invoice Listing. The Invoice Listing is a simple list of Row 2 of Summary Sheet from every Invoice that is created. I need a macro that allows for changes to the invoice data once it's saved (i.e. extra billable hours, which changes information in Row 2 of Summary Sheet). I'd like the macro to search for the invoice number from the Invoice (Cell B1 of Invoice Sheet), search through the Invoice Listing, and replace the entire row with the new data from Row 2 of Summary Sheet. The Invoice Template contains the following code (probably totally inefficient): Sub AddtoList() Sheets ("Invoice").Select Range ("B1").Select Selection.Copy Selection.PasteSpecial Paste:=xlPasteValues, Operation:xlNone, SkipBlanks_:=False,Transpose:=False Sheets("Summary").Select Rows("2:2").Select Selection.Copy Workbooks.Open Filename:=_ "M:\ACCTS\TEMPLATES&FORMS\Invoicing\Invoice Listing.xls" Range ("A1"). Select Do If IsEmpty(ActiveCell) = False Then ActiveCell.Offset(1, 0).Select End If Loop Until IsEmpty(ActiveCell) = True Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, Skipblanks_:=False, Transpose:=False ActiveWorkbook.Save ActiveWindow.Close End Sub Thanks so much for any help that anyone can provide. I'm at my wits end :) |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro Search and Replace | Excel Discussion (Misc queries) | |||
VB Macro to Automate a Search/Replace | Excel Programming | |||
Variable in a Search and Replace macro | Excel Programming | |||
Macro to Search and Replace | Excel Programming | |||
SEARCH & REPLACE MACRO | Excel Programming |