![]() |
Find existing number in another workbook
I am using vba code to copy data from various excel sheets to a master
(database) excel sheet. These are invoices that I track. I create the invoices and then execute a macro to copy and paste the data to the master sheet in the proper columns. Right now, I simply find the last row with data and insert the new data into the next available row. I would like to be able to check to see if the invoice number exists and have a dialog box pop up and ask if the data should be overwritten. If the result is yes, I would like to copy the new data over the existing row of cells in the master sheet. I will paste my current code below. On Error Resume Next Workbooks.Open Filename:= _ "C:\...\Invoicing.xls" Application.ScreenUpdating = False ThisWorkbook.Activate Application.Goto Reference:="Inv_Number" Selection.Copy Windows("Invoicing.xls").Activate Sheets("Invoices").Select Application.Goto Reference:="Invoice" Selection.End(xlDown).Select ActiveCell.Offset(1, 0).Range("A1").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False ThisWorkbook.Activate Application.Goto Reference:="Cust_No" Application.CutCopyMode = False Selection.Copy Windows("Invoicing.xls").Activate ActiveCell.Offset(0, 1).Range("A1").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False ThisWorkbook.Activate Application.Goto Reference:="Cust_Name" Application.CutCopyMode = False Selection.Copy Windows("Invoicing.xls").Activate ActiveCell.Offset(0, 1).Range("A1").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False etc. End Sub Thanks in advance for any help with this! |
All times are GMT +1. The time now is 07:41 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com