• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 32. Building Solutions with VBA > Common Problems and Solutions

Common Problems and Solutions

Q1:There are several lines of code that I'd like to skip over while I'm testing my code, but I'll need to restore the lines later. Is there a quick way to do this?
A1: Yes. In the VBE, display the Edit toolbar, which has a pair of buttons named Comment Block and Uncomment Block. Select the lines you want to skip over and click the Comment Block button to put comment characters at the beginning of every selected line. To remove the comment characters, select the lines that you previously commented and click the Uncomment Block button.
Q2:I have some data I need to hide from the user of my application, but I like the ease of editing it on a worksheet. Can I prevent the users from unhiding the worksheets where I store this data?
A2: Yes. In the Open procedure for the workbook, set the Visible property for the sheet to xlVeryHidden, as shown here. The user will not be able to unhide the worksheet using Excels commands.
Sheets("Lists").Visible = xlVeryHidden

You can write a separate macro that unhides the sheet by setting the Visible property of the sheet to True.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint