tinytoontown
New Member
- Joined
- Apr 13, 2019
- Messages
- 3
Hi
So, i'm using excel 365 and i am creating a preferences page for users to be able to show/hide columns in my [Data] tab which has 94 columns.
I have my images to show/hide column C [DataColumn_C_Hide] and [DataColumn_C_Show]
(These will be replicated and the name adjusted 94 times, unless someone can offer a neater solution)
at the moment i have these 2 subs, but i would really like to pass in the [picture name] and the [column] reference in to just on sub
Sub DataColumn_C_Show()
Application.ScreenUpdating = False
Data.Columns("C:C").ColumnWidth = 20
Preference.Shapes("DataColumn_C_Hide").Visible = False
Preference.Shapes("DataColumn_C_Show").Visible = True
Application.ScreenUpdating = True
End Sub
Sub DataColumn_C_Hide()
Application.ScreenUpdating = False
Data.Columns("C:C").ColumnWidth = 0
Preference.Shapes("DataColumn_C_Hide").Visible = True
Preference.Shapes("DataColumn_C_Show").Visible = False
Application.ScreenUpdating = True
End Sub
any help greatly welcome as i don't want to write 180 subs
So, i'm using excel 365 and i am creating a preferences page for users to be able to show/hide columns in my [Data] tab which has 94 columns.
I have my images to show/hide column C [DataColumn_C_Hide] and [DataColumn_C_Show]
(These will be replicated and the name adjusted 94 times, unless someone can offer a neater solution)
at the moment i have these 2 subs, but i would really like to pass in the [picture name] and the [column] reference in to just on sub
Sub DataColumn_C_Show()
Application.ScreenUpdating = False
Data.Columns("C:C").ColumnWidth = 20
Preference.Shapes("DataColumn_C_Hide").Visible = False
Preference.Shapes("DataColumn_C_Show").Visible = True
Application.ScreenUpdating = True
End Sub
Sub DataColumn_C_Hide()
Application.ScreenUpdating = False
Data.Columns("C:C").ColumnWidth = 0
Preference.Shapes("DataColumn_C_Hide").Visible = True
Preference.Shapes("DataColumn_C_Show").Visible = False
Application.ScreenUpdating = True
End Sub
any help greatly welcome as i don't want to write 180 subs