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, 2022 in Others by Kithuzzz
• 38,010 points
321 views

1 answer to this question.

0 votes

Use the workbook_open even within ThisWorkbook.

enter image description here

answered Oct 20, 2022 by narikkadan
• 63,420 points

Related Questions In Others

0 votes
1 answer

How do I run a VBA Sub routine continuously when working in a Workbook and not only when the Workbook is opened?

on Thisworkbook, put: Private Sub Workbook_Open() Call checkPW(True) End Sub Then ...READ MORE

answered Jan 14, 2023 in Others by narikkadan
• 63,420 points
339 views
0 votes
1 answer

VBA Help to find a column based on header value and cupy it to an other worksheet

You can break out the "copy column ...READ MORE

answered Jan 26, 2023 in Others by narikkadan
• 63,420 points
1,642 views
0 votes
1 answer

Sum the total of a column in excel and paste the sum to a different workbook

Get Column Sum From Closed Workbook Option Explicit Sub ...READ MORE

answered Jan 26, 2023 in Others by narikkadan
• 63,420 points
369 views
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,740 points
916 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
3,240 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, 2022 in Others by gaurav
• 23,260 points
532 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, 2022 in Others by Edureka
• 13,670 points
769 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, 2022 in Others by narikkadan
• 63,420 points
3,014 views
0 votes
1 answer

How to find the last row in a column using openpyxl normal workbook?

ws.max_row will give you the number of rows ...READ MORE

answered Dec 25, 2022 in Others by narikkadan
• 63,420 points
5,086 views
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