brent3162
New Member
- Joined
- Jul 13, 2024
- Messages
- 11
- Office Version
- 365
- Platform
- MacOS
I have a workbook that I am trying to build for my son. I'm not a VBA person and have been working my way through it though. I have an Invoice worksheet that I want to copy selected content to a "All Invoices" worksheet, InvoiceNumber, Date, Name, Total cost. So that he can look at this one all invoices worksheet and see all of his sales. The invoices primary purpose is to print an invoice.
I have one macro that I created that copies these fields and puts them in a cell I selected. But when I run it again the next row is not being used and it copies over itself every time. Can someone who is a better programmer than me (shouldn't be too hard) help me with incrementing the row value when pasting new invoices to the list.
Here is my current macro:
Sub Save_Invoice()
'
' Saving_invoice number
Range("G7").Select
Selection.Copy
Sheets("ALL_INVOICES").Select
Range("A4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
' Saving Invoice Date
Range("G8").Select
Selection.Copy
Sheets("ALL_INVOICES").Select
Range("B4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
' Saving Customer Name
Sheets("INVOICE").Select
Range("C7").Select
Selection.Copy
Sheets("ALL_INVOICES").Select
Range("C4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
' Saving Invoice Total
Sheets("INVOICE").Select
Range("G43").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("ALL_INVOICES").Select
Range("D4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End Sub
I have one macro that I created that copies these fields and puts them in a cell I selected. But when I run it again the next row is not being used and it copies over itself every time. Can someone who is a better programmer than me (shouldn't be too hard) help me with incrementing the row value when pasting new invoices to the list.
Here is my current macro:
Sub Save_Invoice()
'
' Saving_invoice number
Range("G7").Select
Selection.Copy
Sheets("ALL_INVOICES").Select
Range("A4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
' Saving Invoice Date
Range("G8").Select
Selection.Copy
Sheets("ALL_INVOICES").Select
Range("B4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
' Saving Customer Name
Sheets("INVOICE").Select
Range("C7").Select
Selection.Copy
Sheets("ALL_INVOICES").Select
Range("C4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
' Saving Invoice Total
Sheets("INVOICE").Select
Range("G43").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("ALL_INVOICES").Select
Range("D4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End Sub