Is there anyway to amend the below code to allow it to work in multiple worksheets.
Also can it be amended to work as soon as data is input the the sheet rather than the use of a command button.
Sub Macro4()
'Step 1: Declare Your Variables.
Dim LastBlankRow As Long
'Step 2: Capture the last used row number.
LastBlankRow = Cells(Rows.Count, 1).End(xlUp).Row
'Step 3: Select the next row down
Cells(LastBlankRow, 2).Select
'Step 4: Enter "Team Total" in active cell
ActiveCell.FormulaR1C1 = "Team Total"
End Sub
The code works perfectly when input in Sheet1 however when i put the exact same code in to sheet 2 with identical data it give me the following message: Run-time error '1004': Application-defined or object-defined error.
Also it worked when i assigned to a command button but what i want it to do is work automatically when i paste data to the sheet.
Also can it be amended to work as soon as data is input the the sheet rather than the use of a command button.
Sub Macro4()
'Step 1: Declare Your Variables.
Dim LastBlankRow As Long
'Step 2: Capture the last used row number.
LastBlankRow = Cells(Rows.Count, 1).End(xlUp).Row
'Step 3: Select the next row down
Cells(LastBlankRow, 2).Select
'Step 4: Enter "Team Total" in active cell
ActiveCell.FormulaR1C1 = "Team Total"
End Sub
The code works perfectly when input in Sheet1 however when i put the exact same code in to sheet 2 with identical data it give me the following message: Run-time error '1004': Application-defined or object-defined error.
Also it worked when i assigned to a command button but what i want it to do is work automatically when i paste data to the sheet.