Screen change using Forms Control - Combo Box

R

Rafael Chang

Hey Folks,

Does anyone know how can I use the Combo Box from Forms
Control in order to make some changes to the Worksheet?
For example, I want to choose an option from the Combo
Box that will display only some columns and lines (while I
hide others) depending on the selection.

I would greatly appreciate the help.
 
S

StarTrek an beyond

Rafael,

Try using a macro instead. Combox Box only has

Input range
Refers to a list of values on a worksheet. This range provides the
values in the drop-down list.
Cell link
A cell that returns a value that represents the selected item in
the list. This number can be used in a formula to return a result based on
the selected item in the list.

Where as the macro is what ever your do is recorded.
Example

Sub hidecol()
'
' hidecol Macro
' Macro recorded 8/30/2003 by
'

'
Columns("B:B").Select
Range("B2").Activate
Selection.EntireColumn.Hidden = True
End Sub

will hide column B. This can be changed to unhide by changing the True to
False.

The macro can be combined to hide rows to.

or you can use the BUTTON along with the macro. Just clicking the button
will run the macro.

HTH

Wayne B
 
R

Rafael Chang

Hey Wayne,

I could use the VBA Code you mentioned except that it
will only run if it is triggered by a button or anything.
I am looking for anything that will trigger the changes
when I select the drop-down list from "A" to "B", for
example.
Thanks in advance.
 
T

Tom Ogilvy

You can assign the macro to the dropdown box - so when a selection is made,
the code will run. You will need to alter the code to use the value of the
dropdown box.

Public Sub DropDown1_Click()
Activesheet.Columns.Hidden = False
Activesheet.columns(Activesheet.Dropdowns( _
"Drop Down 1").Value).Hidden = True
End Sub
 

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