Please help with Macro delaring variables
Posted by Ken on January 28, 2002 1:24 PM
Please help with this macro and tell me how to set the variables correctly and make it run faster.
Sub AddPO()
Dim Lastsheetname As Variant
Application.ScreenUpdating = False
Lastsheetname = Sheets(Sheets.Count).Name
Sheets(Sheets.Count).Copy After:=Sheets(Sheets.Count)
Sheets(Sheets.Count).Name = Lastsheetname + 1
Sheets(Sheets.Count).Range("D8") = Sheets(Sheets.Count).Name
Sheets(Sheets.Count).Range("A44:F70").Select
Selection.ClearContents
With Selection.Interior
.ColorIndex = 2
End With
Sheets(Sheets.Count).Range("D10").Select
ActiveCell.FormulaR1C1 = "=TODAY()"
Selection.Copy
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Application.CutCopyMode = False
Sheets(Sheets.Count).Range("D11").Select
ActiveCell.FormulaR1C1 = "=R[-1]C+1"
Selection.Copy
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Application.CutCopyMode = False
Sheets(Sheets.Count).Range("C45").Select
Application.ScreenUpdating = True
End Sub
Thanks
Ken