VBA to unhide a column when opening a workbook

0 votes

To give the user the choice of viewing only the data they need and when they need it, my user form contains two buttons: one to unhide column A and another one to hide column A. Below is the code for this.

  Private Sub OptionButton3_Click()
  'Hide column A
  Worksheets("Page1").Columns("A:A").Hidden = True
  End Sub


  Private Sub OptionButton4_Click()
  'UnHide column A
  Worksheets("Page1").Columns("A:A").Hidden = False
  End Sub

But every time the user opens the workbook, I want column A to be visible (unhidden) by default. For instance, even if the user saves the workbook with column A hidden, I want column A to immediately be displayed by default the following time the same spreadsheet is opened. I'm not sure how to change the above VBA to accommodate that. We would appreciate any assistance.

Oct 20 in Others by Kithuzzz
• 20,660 points
36 views

1 answer to this question.

0 votes

Use the workbook_open even within ThisWorkbook.

enter image description here

answered Oct 20 by narikkadan
• 37,660 points

Related Questions In Others

0 votes
0 answers

How to convert a data frame column to numeric type?

How can we convert a data frame ...READ MORE

Jun 13 in Others by Avinash
• 1,260 points
51 views
0 votes
1 answer

Is there a way in Microsoft Excel to give specific bins different bin widths when making a histogram plot?

Excel built-in histogram tool only allows equal ...READ MORE

answered Oct 2 in Others by narikkadan
• 37,660 points
69 views
0 votes
1 answer
0 votes
1 answer

Retrieve epay.info Balance with VBA and Excel

This code should log you in, provided ...READ MORE

answered Sep 5, 2018 in Blockchain by digger
• 26,720 points
454 views
0 votes
1 answer

How to load file to Excel Power query from SFTP site

Currently, I don't think there is a ...READ MORE

answered Dec 3, 2018 in Power BI by Upasana
• 8,620 points
2,228 views
0 votes
1 answer

Using VBA Excel to create a gramatically correct list

The Excel AND function is a logical ...READ MORE

answered Feb 9 in Others by gaurav
• 22,040 points
71 views
0 votes
2 answers

How to copy a formula horizontally within a table using Excel VBA?

Hi so basically, create an adjacent column ...READ MORE

answered Feb 16 in Others by Edureka
• 13,640 points
210 views
0 votes
1 answer

How to find a value in an excel column by vba code Cells.Find

Just use: Dim Cell As Range Columns("B:B").Select Set cell = ...READ MORE

answered Nov 17 in Others by narikkadan
• 37,660 points
31 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP