Good morning,
I wrote some code today and it compiled fine in one xcel workbook. I copied it and set up the macro in a different workbook. Now it's giving me the following error:
Argument not optional
and pointing at my variable to determine the last row used in the tab. What did I do wrong? It's the SAME CODE!
Here is the entire code:
Sub UpdateFinal()
'
' UpdateFinal Macro
' Written 10/5/2006 to update and sort master list
'
Sheets("Master" ).Select
'Selects Master list
LastRow = ActiveSheet.Cel ls(65536, 1).End(xlUp).Ro w
Range("A3", ActiveSheet.Cel ls(LastRow, 26)).Select
Selection.Delet e
'Clears all data from "Master" tab
Sheets("FoHF"). Select
LastRow = ActiveSheet.Cel ls(65536, 1).End(xlUp).Ro w
Range("A3", ActiveSheet.Cel ls(LastRow, 26)).Select
Selection.Copy
'Copies current information from "FoHF" tab
Sheets("Master" ).Select
ActiveSheet.Ran ge("A1").End(xl Down).Offset(1, 0).Select
ActiveSheet.Pas te
'Pastes to "Master" tab
Sheets("RA").Se lect
Application.Cut CopyMode = False
LastRow = ActiveSheet.Cel ls(65536, 1).End(xlUp).Ro w
Range("A3", ActiveSheet.Cel ls(LastRow, 26)).Select
Selection.Copy
'Copies current information from "RA" tab
Sheets("Master" ).Select
ActiveSheet.Ran ge("A65536").En d(xlUp).Offset( 1, 0).Select
ActiveSheet.Pas te
'Pastes to "Master" tab
Sheets("RE").Se lect
Application.Cut CopyMode = False
LastRow = ActiveSheet.Cel ls(65536, 1).End(xlUp).Ro w
Range("A3", ActiveSheet.Cel ls(LastRow, 26)).Select
Selection.Copy
'Copies current information from "RE" tab
Sheets("Master" ).Select
ActiveSheet.Ran ge("A65536").En d(xlUp).Offset( 1, 0).Select
ActiveSheet.Pas te
'Pastes to "Master" tab
Sheets("PE").Se lect
Application.Cut CopyMode = False
LastRow = ActiveSheet.Cel ls(65536, 1).End(xlUp).Ro w
Range("A3", ActiveSheet.Cel ls(LastRow, 26)).Select
Selection.Copy
'Copies current information from "PE" tab
Sheets("Master" ).Select
ActiveSheet.Ran ge("A65536").En d(xlUp).Offset( 1, 0).Select
ActiveSheet.Pas te
'Pastes to "Master" tab
Rows("3:65536") .Select
Application.Cut CopyMode = False
Selection.Sort Key1:=Range("C3 "), Order1:=xlAscen ding, Header:=xlGuess , _
OrderCustom:=1, MatchCase:=Fals e, Orientation:=xl TopToBottom, _
DataOption1:=xl SortNormal
'Sorts alphabetically by Manager Name
End Sub
HELP!
I wrote some code today and it compiled fine in one xcel workbook. I copied it and set up the macro in a different workbook. Now it's giving me the following error:
Argument not optional
and pointing at my variable to determine the last row used in the tab. What did I do wrong? It's the SAME CODE!
Here is the entire code:
Sub UpdateFinal()
'
' UpdateFinal Macro
' Written 10/5/2006 to update and sort master list
'
Sheets("Master" ).Select
'Selects Master list
LastRow = ActiveSheet.Cel ls(65536, 1).End(xlUp).Ro w
Range("A3", ActiveSheet.Cel ls(LastRow, 26)).Select
Selection.Delet e
'Clears all data from "Master" tab
Sheets("FoHF"). Select
LastRow = ActiveSheet.Cel ls(65536, 1).End(xlUp).Ro w
Range("A3", ActiveSheet.Cel ls(LastRow, 26)).Select
Selection.Copy
'Copies current information from "FoHF" tab
Sheets("Master" ).Select
ActiveSheet.Ran ge("A1").End(xl Down).Offset(1, 0).Select
ActiveSheet.Pas te
'Pastes to "Master" tab
Sheets("RA").Se lect
Application.Cut CopyMode = False
LastRow = ActiveSheet.Cel ls(65536, 1).End(xlUp).Ro w
Range("A3", ActiveSheet.Cel ls(LastRow, 26)).Select
Selection.Copy
'Copies current information from "RA" tab
Sheets("Master" ).Select
ActiveSheet.Ran ge("A65536").En d(xlUp).Offset( 1, 0).Select
ActiveSheet.Pas te
'Pastes to "Master" tab
Sheets("RE").Se lect
Application.Cut CopyMode = False
LastRow = ActiveSheet.Cel ls(65536, 1).End(xlUp).Ro w
Range("A3", ActiveSheet.Cel ls(LastRow, 26)).Select
Selection.Copy
'Copies current information from "RE" tab
Sheets("Master" ).Select
ActiveSheet.Ran ge("A65536").En d(xlUp).Offset( 1, 0).Select
ActiveSheet.Pas te
'Pastes to "Master" tab
Sheets("PE").Se lect
Application.Cut CopyMode = False
LastRow = ActiveSheet.Cel ls(65536, 1).End(xlUp).Ro w
Range("A3", ActiveSheet.Cel ls(LastRow, 26)).Select
Selection.Copy
'Copies current information from "PE" tab
Sheets("Master" ).Select
ActiveSheet.Ran ge("A65536").En d(xlUp).Offset( 1, 0).Select
ActiveSheet.Pas te
'Pastes to "Master" tab
Rows("3:65536") .Select
Application.Cut CopyMode = False
Selection.Sort Key1:=Range("C3 "), Order1:=xlAscen ding, Header:=xlGuess , _
OrderCustom:=1, MatchCase:=Fals e, Orientation:=xl TopToBottom, _
DataOption1:=xl SortNormal
'Sorts alphabetically by Manager Name
End Sub
HELP!
Comment