Re: [RESOLVED] Copy From One WorkBook To Another: Excel VBA
I'm testing it and it seems to work fine.... verify the extension on the file and the actual address. that error is given when the file can't be found.... try closing the file when running the script... it may help
I have been searching for a VBA solution to my problem. On reading the Posts here, I realised they relate almost to what I need. I should be very grateful to forum members for help, please.
I have the following two sheets in Excel:
a) Sheet 1 named (Receipts) with 2 columns as follows:
Column A = Invoice No.
Column B = Date Paid (current receipts)
b) Sheet 2 named (DataTable) with about 8 columns, which include the following:
Column A = Invoice No.
Column G = Date Paid
The invoice numbers in Sheet 1 column A are also available in Sheet 2 column A.
Column G in Sheet 2 contains both the actual dates invoices were paid (in dd/mm/yyyy format) and also the text ‘UNPAID’ for those invoices not yet paid.
I need help with a VBA code that will replace the texts ‘UNPAID’ in whichever cells they appear in Sheet 2 Column G, with the actual dates paid, as shown in Sheet 1 Column B, in respect of all the invoice numbers listed also in Sheet 1 Column A.
IN SUMMARY:
a) Go to Sheet 1 (named ‘Receipts’)
b) Pick the invoice nos. in Column A including their related ‘dates paid’ in Column B.
c) Go to Sheet 2 (named ‘Data Table’)
d) Search Column A for the invoice nos. picked from Sheet 1 (named ‘Receipts’)
e) For each matching invoice no. found in Sheet 2 (Data Table), replace the text ‘UNPAID’ which appears against that invoice no. in Column G with the ‘date paid’ value picked up from Sheet 1.
f) All invoice nos. from Sheet 1 Column A that already have ‘date paid’ values in Sheet 2 Column G against their corresponding nos. should be ignored, (i.e. no action).
I have attached a small sample of the sheets referred to. I need help with this as the entries I am regularly dealing with run into hundreds of rows. The Data Table (Sheet 2) is regularly updated with new unpaid invoices. At the same time, Sheet 1 (Receipts) is also updated with very many paid invoices nos. and dates added regularly.