Excel Excel Challenge

Joined
Jun 16, 2010
Messages
2
Reaction score
0
auto hide column

I have a created an combo box in excel 07. that is linked to a data set on another worksheet that flex an array similar to something like this

combo option1| combo option2|combo option3|combo option4

coltohide1 yes no yes no
coltohide2 no yes no no
coltohide3 yes yes yes no
coltohide4 no yes yes no
coltohide5 no no no yes
coltohide6

and for argument sake lets say depending on what is selected on the combo box option it will hide the columns ......
 
Last edited:
Joined
Jun 16, 2010
Messages
2
Reaction score
0
ok here what is helping with the answer but i would like to attached a combo box with this

master_data_sheet = "master"
master_data_row = 2
master_data_col = 2
Master_loop = 0
View_picker_row = 2
View_picker_col = 2

view_data_Sheet = "view"
view_data_row = 2
view_data_col = 2
view_loop = 0


'Find What view they want to see
xview = Sheets(master_data_sheet).Cells(View_picker_row, View_picker_col)
Debug.Print xview
'Find what col is view in
view_setting_col = view_data_col + 1
view_setting_row = view_data_row - 1
Do While True
If Sheets(view_data_Sheet).Cells(view_setting_row, view_setting_col) = xview Then
Exit Do
Else
view_setting_col = view_setting_col + 1
End If

If view_setting_col > 800 Then Exit Do
Loop
Debug.Print view_setting_col







Do While Master_loop = 0
master_field = Sheets(master_data_sheet).Cells(master_data_row, master_data_col)
If master_field = "" Then
Master_loop = 1
Exit Do
Else
'Loop to see if I should hide this field
view_loop = 0
x_data_row = view_data_row
Do While view_loop = 0
view_field = Sheets(view_data_Sheet).Cells(x_data_row, view_data_col)
If view_field = "" Then
view_loop = 1
Exit Do
Else
'check to see if we can hide
If master_field = view_field Then
If Sheets(view_data_Sheet).Cells(x_data_row, view_setting_col) = "X" Then
'hide the master sheet col
Sheets(master_data_sheet).Columns(master_data_col).Hidden = True



End If



End If




End If
x_data_row = x_data_row + 1


Loop


End If

master_data_col = master_data_col + 1

Loop
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top