The best way to start in my opinion is to record some simple macros and review the code it creates.I'm self-taught in excel and so still have much to learn and have never used macros before.
Sub UnhideB2E()
Columns("A:F").Select
Selection.EntireColumn.Hidden = False
Range("A1").Select 'This line just selects cell A1 in order to deselect the Columns
End Sub
The best way to start in my opinion is to record some simple macros and review the code it creates.
From there, check out the free course on Excel VBA here. The Beginner course in the Playlist will give you a very solid starting point.
However, the Excel Workbook must be saved as a Macro-enabled Workbook if not one already. From there you can use the following VBA code I got by recording a macro where I unhid Columns B:E:
VBA Code:Sub UnhideB2E() Columns("A:F").Select Selection.EntireColumn.Hidden = False Range("A1").Select 'This line just selects cell A1 in order to deselect the Columns End Sub
I'm self-taught in excel and so still have much to learn and have never used macros before. I want to add a button that expands columns B through E (The button will be in column A). Can someone please help me with how to do this?
Sub Expand_Grouping()
ActiveSheet.Columns(2).ShowDetail = True
End Sub