G
Guest
Hello All,
I am using Excel 97 and need some help with VBA as I don't know it all that
well.
Before the below macro is run, the end user needs to save the workbook as
CSRreport.xls. However, some users forget to save the workbook under the new
name before running the macro, which then causes a problem with the original
file (workbook).
I need the macro (below) to first check that the workbook is named
“CSRreport.xls†before the rest of the code continues. How can I add to the
following code at the beginning to check that the workbook name is
“CSRreport.xls†and if it isn’t, display a message box informing the user to
save the file as “CSRreport.xls and try the macro again.
Sub CSRreport()
' CSRreport Macro
' Macro recorded 5/10/2006
'
If Worksheets("PastDue").Visible = True Then
Worksheets("PastDue").Visible = False
End If
Worksheets("Label Number").Select
Range("U3").Select
CSRFilter
CSRPrintarea
Range("A:A,D,F:G,J:M,S:S,T:T,U:U,V:V,W:W,X:X,Y:Y,Z:Z,AA:AA").Select
Range("AA2").Activate
Selection.EntireColumn.Hidden = True
CSRTitle
End Sub
TIA
Jan
I am using Excel 97 and need some help with VBA as I don't know it all that
well.
Before the below macro is run, the end user needs to save the workbook as
CSRreport.xls. However, some users forget to save the workbook under the new
name before running the macro, which then causes a problem with the original
file (workbook).
I need the macro (below) to first check that the workbook is named
“CSRreport.xls†before the rest of the code continues. How can I add to the
following code at the beginning to check that the workbook name is
“CSRreport.xls†and if it isn’t, display a message box informing the user to
save the file as “CSRreport.xls and try the macro again.
Sub CSRreport()
' CSRreport Macro
' Macro recorded 5/10/2006
'
If Worksheets("PastDue").Visible = True Then
Worksheets("PastDue").Visible = False
End If
Worksheets("Label Number").Select
Range("U3").Select
CSRFilter
CSRPrintarea
Range("A:A,D,F:G,J:M,S:S,T:T,U:U,V:V,W:W,X:X,Y:Y,Z:Z,AA:AA").Select
Range("AA2").Activate
Selection.EntireColumn.Hidden = True
CSRTitle
End Sub
TIA
Jan