Greetings everyone.
I am brand new to this but hungry to learn. I have searched for the answer to no avail.
I have 4 sheets in a workbook and sheet 2 is named InvoiceNumbers. Sheet 3 (MonthlyInvoices) is where I have a commandButton2 with the following code that I have scraped together....and not working.
When I click on the commandButton2 I want the following to happen:
go to sheet InvoiceNumbers and find the next empty cell in column F, and insert the value "1". Return to MonthlyInvoice and select cell C14 and throw up a message box to tell the user to enter the next customer number.
Your help will be greatly appreciated.
Private Sub CommandButton2_Click()
' Update Data
Sheets("InvoiceNumbers").Select
Column("F:F").Select
Selection.Find(What:="", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
ActiveCell.FormulaR1C1 = "1"
Sheets("MonthlyInvoices").Select
Range("C14").Select
ActiveCell.FormulaR1C1 = "0"
Range("C14").Select
ActiveWorkbook.Save
CommandButton1.Enabled = True
End Sub
I am brand new to this but hungry to learn. I have searched for the answer to no avail.
I have 4 sheets in a workbook and sheet 2 is named InvoiceNumbers. Sheet 3 (MonthlyInvoices) is where I have a commandButton2 with the following code that I have scraped together....and not working.
When I click on the commandButton2 I want the following to happen:
go to sheet InvoiceNumbers and find the next empty cell in column F, and insert the value "1". Return to MonthlyInvoice and select cell C14 and throw up a message box to tell the user to enter the next customer number.
Your help will be greatly appreciated.
Private Sub CommandButton2_Click()
' Update Data
Sheets("InvoiceNumbers").Select
Column("F:F").Select
Selection.Find(What:="", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
ActiveCell.FormulaR1C1 = "1"
Sheets("MonthlyInvoices").Select
Range("C14").Select
ActiveCell.FormulaR1C1 = "0"
Range("C14").Select
ActiveWorkbook.Save
CommandButton1.Enabled = True
End Sub