Hi,
I set up a Excel macro to compare the sheets of the current Workbook with those of the previous book, to make sure the numbers on those sheets do not go too far apart.
However, if one of the tabs cannot be found in the Workbook, a square box will appear with a header of 'Select Sheet'. I have some 20 Workbooks and I don't want to click 'OK' or 'Cancel' 100 times to keep the process running.
I tried 'On Error Resume Next' and Application.DisplayAlerts=False but the box still keeps showing up.
Is there any way of keeping the box from showing up?
Here is a part of the macro (where the garb_tab not exist):
Sub Findout(RegionWorkbook As String)
'On Error Resume Next
Dim tabarray As Variant
RegionWorkbook_ = Replace(RegionWorkbook, "2008_08_", "2008_09_")
tabarray = Array("garb_tab", "garb_tab", "region_name", "region_name", "district_name", "district_name", _
"territory_name", "territory_name", "distpayerlist", "distpayerlist")
For i = LBound(tabarray) To UBound(tabarray) Step 2
j = i + 1
k = i + 2
Sheets("sheet" & j).Activate
ActiveSheet.UsedRange.ClearContents
GetValuesFromAClosedWorkbook "C:\jqzhang\tooltemp", RegionWorkbook, tabarray(i), "A1:A3000", "A1:A3000"
Call DeleteRows
ActiveSheet.Cells(Range("a1").CurrentRegion.Rows.Count, 1).Activate
Sheets("sheet" & k).Activate
ActiveSheet.UsedRange.ClearContents
GetValuesFromAClosedWorkbook "C:\jqzhang\tooltemp", RegionWorkbook_, tabarray(i), "A1:A3000", "A1:A3000"
Call DeleteRows
ActiveSheet.Cells(Range("a1").CurrentRegion.Rows.Count, 1).Activate
Next
On Error GoTo 0
End Sub
Sub CMTNSA()
Findout "Stl_An_Tool_2008_08_MHC.xls"
End Sub
I set up a Excel macro to compare the sheets of the current Workbook with those of the previous book, to make sure the numbers on those sheets do not go too far apart.
However, if one of the tabs cannot be found in the Workbook, a square box will appear with a header of 'Select Sheet'. I have some 20 Workbooks and I don't want to click 'OK' or 'Cancel' 100 times to keep the process running.
I tried 'On Error Resume Next' and Application.DisplayAlerts=False but the box still keeps showing up.
Is there any way of keeping the box from showing up?
Here is a part of the macro (where the garb_tab not exist):
Sub Findout(RegionWorkbook As String)
'On Error Resume Next
Dim tabarray As Variant
RegionWorkbook_ = Replace(RegionWorkbook, "2008_08_", "2008_09_")
tabarray = Array("garb_tab", "garb_tab", "region_name", "region_name", "district_name", "district_name", _
"territory_name", "territory_name", "distpayerlist", "distpayerlist")
For i = LBound(tabarray) To UBound(tabarray) Step 2
j = i + 1
k = i + 2
Sheets("sheet" & j).Activate
ActiveSheet.UsedRange.ClearContents
GetValuesFromAClosedWorkbook "C:\jqzhang\tooltemp", RegionWorkbook, tabarray(i), "A1:A3000", "A1:A3000"
Call DeleteRows
ActiveSheet.Cells(Range("a1").CurrentRegion.Rows.Count, 1).Activate
Sheets("sheet" & k).Activate
ActiveSheet.UsedRange.ClearContents
GetValuesFromAClosedWorkbook "C:\jqzhang\tooltemp", RegionWorkbook_, tabarray(i), "A1:A3000", "A1:A3000"
Call DeleteRows
ActiveSheet.Cells(Range("a1").CurrentRegion.Rows.Count, 1).Activate
Next
On Error GoTo 0
End Sub
Sub CMTNSA()
Findout "Stl_An_Tool_2008_08_MHC.xls"
End Sub