View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Brian Brian is offline
external usenet poster
 
Posts: 683
Default Problem running sub on a User Form

I have a User Form that has (21) check boxes for making the worksheets in the
workbook visible or hidden. Also on this User Form there is an Update Control
Button that is clicked to transfer the Data from the User Form to the
Worksheet.

My problem is if the Worksheet is hidden and I try to update the workbook I
get an error message.

Run_Time Error 1004
Select Method of worksheet class failed

The following code works perfect as long as all the worksheets are visable,
but once you hide one of the worksheets I get above error message. I am not
sure how to code this to check if worksheet is hidden bypass that sub and
continue on.

Sub Update_Installer_Forms5()

For i = 601 To 620
On Error GoTo NoSelection
If UserForm1("Battery_String_Qty_" & i) Then

On Error GoTo 0 'Reset error trapping
Run "Battery_String_" & Mid(i, 2)
Exit For

End If
Next i
Exit Sub

NoSelection:
MsgBox "No Batteries Selected." & vbLf _
& "Processing Terminated."
Exit Sub
End Sub