Hide/unhide columns macro

jkopedia

New Member
Joined
Jul 12, 2018
Messages
17
I am working on an analysis spreadsheet which allows for multiple properties to be analysed or for a single property to be analysed and as part of this I have several areas where there is the option to open up additional columns for properties if needed by the user. I have a macro to unhide these columns in order from property 1 to 10, however I am looking for a macro that will allow me to hide these columns from property 10 to 1 (reverse order), but can't seem to get it right. If I reverse my unhide macro it will hide them from 1 to 10, not 10 to 1 so I'm a little stumped how to get the format I want.

Can anyone help with this? My unhide macro is below if of any use for context; Essentially, this one is unhiding the columns from L to FE, but I would like the hide function to go from FE to L
__________________________
Sub UnhideACol()
Dim HiddenRange As Range, c As Range
Dim i As Integer
Set HiddenRange = Range("L6:FE74")
For i = 5 To 1 Step -1
For Each c In HiddenRange
If c.EntireColumn.Hidden = True Then
c.EntireColumn.Hidden = False
Exit For
End If
Next c
Next
End Sub
 
Good Question......

Row Macro: Say our initial start point is row 1 (so the info set goes from row 1-5), can we set the macro so it stays with rows 1-5 even if it becomes rows 2-6 from inserting a row above?

Column Macro: Say our initial start point is Column A (so the info set goes from row A-E), can we set the macro so it stays with columns A-E even if it becomes columns B-F from inserting a Column to the left?
 
Upvote 0

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Is there anything in row 4 that identifies it as the first row that will not be hidden?
 
Upvote 0
Are you saying that the first group of rows will have a 1 in col A of that group.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,175
Members
453,021
Latest member
Justyna P

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