I am not familiar with error trapping on valid input, because the user needs to select month from a dropbox and the rest of the procedures is automatic.
The below is the first macro to be ran, and it will open another file in the server and update the information in my sheet. However the file to be picked changes monthly, therefore you need to manually change or pick from a dropbox the month that you want to run the report for. O4 contains a dropbox to select month.
Sub Get_DataFrom_VarianceBook()
Dim StrFileName As String
Sheets("Month").Select
Range("O4").Select
StrFileName = ActiveCell.Value
Workbooks.Open Filename:= _
"S:\ACCT\CostDept\WD Variances & Recons 2004\Variance Books 2004\" + StrFileName
'Grab the Variance Book Data
Windows(StrFileName).Activate
Sheets(2).Select
Range("F1").Select
Selection.AutoFilter
Selection.AutoFilter Field:=7, Criteria1:="411"
Selection.CurrentRegion.Select
Selection.Copy
Windows("ME Performance Report Plants.xls").Activate
Range("h7").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Windows(StrFileName).Activate
ActiveWindow.Close
End Sub
This is how I calling or firing the macros>>>
Application.Run "PERSONAL.XLS!PasteSpeciaValues"
I would appreciate if you can give me further detail as to how test for a condition.
Thanks,