Link a specific cell from new sheet to a Log Sheet Automatically.

hannakaram

New Member
I create a account Statement and Invoices Workbook File,
First sheet is the account Statement, and after each sheet will be a new invoice.
I want each time I add a new sheet as a new invoice, as Copy Paste, a specific data from a specific cells in that new invoice sheet will go automatically to the first blank or empty row in the statement sheet, without to link it one by one manually.
How I can do that.
I can send the file to see it.
 

DanteAmor

Well-known Member
Upload your book to the cloud and share it to put the macro.
Tell me which or which cells should be sent to the "account Statement" sheet

You could upload a copy of your file to a free site such www.dropbox.com. Once you do that, mark it for 'Sharing' and you will be given a link to the file that you can post here. If the workbook contains confidential information, you could replace it with generic data.
 

hannakaram

New Member
Upload your book to the cloud and share it to put the macro.
Tell me which or which cells should be sent to the "account Statement" sheet

You could upload a copy of your file to a free site such www.dropbox.com. Once you do that, mark it for 'Sharing' and you will be given a link to the file that you can post here. If the workbook contains confidential information, you could replace it with generic data.
Thanks for your reply
Here is a link to the file,
https://www.dropbox.com/s/4ll0src44y3uf9d/My Client Company Name.xlsx?dl=0

Thanks
 

DanteAmor

Well-known Member
But you didn't explain, which cells are taken from "Statement" and where they should be put in the new one.
 

hannakaram

New Member
But you didn't explain, which cells are taken from "Statement" and where they should be put in the new one.
You can see the cells in the statement which is linked to the invoices
Example are in invoice #1 and Invoice #2
What I want is when I add Invoice #3 and more, same cells from invoices will go to the Statement

And in details will be as follow:

Invoice!H3 to Statement Column !A
Invoice!E3 to Statement Column !B
Invoice!G11 to Statement Column !C
Invoice!G12 to Statement Column !E
Invoice!I36 to Statement Column !I

So it is a specific Cells from the Invoices, but going to find them places in the first empty row in a specific Column

I am sure you understand what I need.

Thanks for your concern
 

DanteAmor

Well-known Member
Try this.

Put the macro in a module, select the new invoice and run the macro.

Code:
Sub Fill_Statement()
  Dim sh As Worksheet, i As Long, f As Range
  Set sh = Sheets("Statement")
  
  If LCase(Left(ActiveSheet.Name, 7)) <> LCase("Invoice") Then
    MsgBox "This sheet is not an invoice"
    Exit Sub
  End If
  Set f = sh.Range("B:B").Find(Range("E3"), , xlValues, xlWhole)
  If Not f Is Nothing Then
    MsgBox "This invoice already exists"
    Exit Sub
  End If
  
  i = 19
  Do While sh.Cells(i, "A") <> ""
    i = i + 1
  Loop
  sh.Range("A" & i) = Range("H3")
  sh.Range("B" & i) = Range("E3")
  sh.Range("C" & i) = Range("G11")
  sh.Range("E" & i) = Range("G12")
  sh.Range("I" & i) = Range("I36")
  MsgBox "Registration added"
End Sub
 

Some videos you may like

This Week's Hot Topics

  • Get External Data (long shot question!)
    This is likely a long shot but I am wondering if it is at all possible for Excel to somehow 'change' the contents of a URL that is being linked to...
  • Importing multiple excel files into one spreadsheet
    Hi, I'm trying to import multiple excel files (with the same format into a single spreadsheet) so that each day's file is listed underneath the...
  • Cell Formatting
    Good Morning, I need to format a few different cells in the following manners: A1 has to always add a colon (:) after whatever is typed in by a...
  • How to copy multiple rows using If
    Hi all, I'm very new to VBA and have written this simple code to copy certain cells if a certain cell within that row contains any data. I need...
  • Workbook_Change stopped working !
    I am working on an app to speed up & automate processing of Credit Cards statements. After data is input from a CSV file, it is presented to the...
  • VBA If statement
    Dear All, I have two dates, where I'd like a message box to pop, if the dates are between this criteria. [CODE] sDate1 = #10/1/2019#...
Top