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

hannakaram

New Member
Joined
Aug 9, 2019
Messages
6
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
Joined
Dec 3, 2018
Messages
9,679
Office Version
2007
Platform
Windows
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
Joined
Aug 9, 2019
Messages
6
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
Joined
Dec 3, 2018
Messages
9,679
Office Version
2007
Platform
Windows
But you didn't explain, which cells are taken from "Statement" and where they should be put in the new one.
 

hannakaram

New Member
Joined
Aug 9, 2019
Messages
6
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
Joined
Dec 3, 2018
Messages
9,679
Office Version
2007
Platform
Windows
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
 

Forum statistics

Threads
1,085,522
Messages
5,384,187
Members
401,885
Latest member
nirmalpatel85

Some videos you may like

This Week's Hot Topics

Top