View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Lisa C. Lisa C. is offline
external usenet poster
 
Posts: 23
Default Data Validation List Macro

Joel - This worked great. Thank you!

Got another scenario......If I create two different data validation lists on
the same worksheet, one in cell A1 and one in cell A2, is there a way to have
the combination of the two values selected for these cells to run a macro
that hides/unhides worksheets? Do I need to have a third cell (cell X3) with
a formula that concatenates the two values in A1 and A2 and then use cell X3
in the macro? Can you use a target cell in the macro that has a formula in
it but have the macro use the values calculated from it? How do I keep the
macro from kicking off until both cell A1 and A2 have been valued and
combined in cell X3?

"joel" wrote:

Sub worksheet_change(ByVal target As Range)

Set isect = Application.Intersect(target, Range("A1"))
If Not isect Is Nothing Then

Select Case Range("A1").Value
Case "Account Info"
Sheets("Account Info").Visible = True
Sheets("Order Info").Visible = False
Sheets("Billing Info").Visible = False

Case "Order Info"
Sheets("Account Info").Visible = False
Sheets("Order Info").Visible = True
Sheets("Billing Info").Visible = False
Case "Billing Info"
Sheets("Account Info").Visible = False
Sheets("Order Info").Visible = False
Sheets("Billing Info").Visible = True
End Select
End If

End Sub



"Lisa C." wrote:

Is there a way to run a macro that hides/unhides multiple worksheets based on
the value selected on a data validation list? If so, what would the VB
syntax be for the macro?

For example, if Cell A1 contains a data validation list with 3 values to
choose from (Account Info, Order Info, Billing Info) and Account Info is
chosen, I want to unhide the Account Info worksheet and hide the Order Info
and Billing Info worksheets. If Order Info is chosen, I want to unhide the
Order Info worksheet, and hide the Account Info and Billing Info worksheets,
etc.