Access sheet While Application.Visible = False

ilya2004

Board Regular
Joined
Mar 17, 2011
Messages
135
Hello,

I have a spreadsheet that auto-loads a userform and runs an
Code:
application.visible = false
command.

The issue is that I need the userform to interact with the sheet, but once I have hidden the worksheet I get a "subscript out of range" error.

Is there a way to allow it to do so without unhiding the application?

-Ilya
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Hi Ilya,
Should work, try:
Rich (BB code):

Private Sub UserForm_Initialize()
  Application.Visible = False
End Sub

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
  Application.Visible = True
End Sub

Private Sub CommandButton1_Click()
  With ThisWorkbook.Sheets(1)
    .Range("A1:D3").Value = Now
    MsgBox .Range("A1").Value
  End With
End Sub
Regards
 
Upvote 0

Forum statistics

Threads
1,224,613
Messages
6,179,904
Members
452,948
Latest member
Dupuhini

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