Hello
I am totally new to the world of macros but have done some VBscript on QTP before. I am looking to create a macro which would hide certain columns depending on the users selection from a drop down. I am unsure of the syntax and how to identify the columns I wish to hide and how to identify the cell with the dropdown.
Here's roughly how I would see it looking -
Sub HideColumns()
If cell(ViewType).Value = "Option 1" Then
Cells(Column_1, Column_2).EntireColumn.Hidden = True
ElseIf cell(ViewType).Value = "Option 2" Then
Cells(Column_2, Column_3).EntireColumn.Hidden = True
ElseIf cell(ViewType).Value = "Option 3" Then
Cells(Column_3, Column_4).EntireColumn.Hidden = True
End If
End Sub
I have named the cell with the dropdown "ViewType" in excel - would th vb recognise the object that way, or would I need to declare it?
How do Identify the columns I wish to hide?
Thanks for your help!
Thom