pops up message when run the userform if specific sheet is hidden

KalilMe

Active Member
Joined
Mar 5, 2021
Messages
343
Office Version
  1. 2016
Platform
  1. Windows
hello

I have many sheets are hidden except sheet MAIN to run userform from of it . when I run the userform and the sheet DATA is hidden , then should pops up messge " threre is missed data" and close the userform , and if the sheet DATA is not hidden when run the userform should keep showing .
and if try up to 3 times and three times shows the message then should pops up message" sorry run out your tries" and close the file

thanks
 
even the sheet data is not hidden .it continues showing message
 
Upvote 0

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
perhaps
VBA Code:
Private Sub UserForm_Initialize()

If FormShowCount >= 2 Then
     MsgBox "You have reached the maximum tries allowed." & vbCrLf & vbCrLf & "Workbook will now close."
     ThisWorkbook.Close
     Exit Sub
End If

If Sheets("DATA").Visible = False Then
     MsgBox "Cannot proceed if Data sheet is hidden"
     Unload Me
Else
     FormShowCount = 0
     Exit Sub
End If

FormShowCount = FormShowCount + 1

End Sub
 
Upvote 0
Solution
fantastic ! it works excellently (y)
much appreciated for your following my thread & solving ;)
 
Upvote 0
Wheww! Good, because that's all I've got left in me for this one!
 
Upvote 0

Forum statistics

Threads
1,214,643
Messages
6,120,702
Members
448,980
Latest member
CarlosWin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top