Data Validation List Macro
You can use a worksheet event that will look for changes to specific cells.
In this example, I used A1.
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim sh As Object
If Target.Cells.Count 1 Then
Exit Sub 'one cell at a time
End If
If Intersect(Target, Me.Range("A1")) Is Nothing Then
Exit Sub
End If
For Each sh In Me.Parent.Sheets
If sh.Name = Me.Name Then
'skip it. Keep this sheet visible
Else
If LCase(sh.Name) = LCase(Target.Value) Then
'show this one
sh.Visible = xlSheetVisible
Else
sh.Visible = xlSheetHidden
End If
End If
Next sh
End Sub
If you want to try it, rightclick on the worksheet tab that will have this cell
with the data|validation. Select view code and paste that code into the new
code window.
Lisa C. wrote:
Disregard the subject of "Radio Button Macro". I meant to say "Data
Validation Macro".
"Lisa C." wrote:
Is there a way to use a Data Validation List and run a macro that
hides/unhides worksheets based on what value is selected on the drop down
list? If so, what would the syntax look like for the macro code?
--
Dave Peterson
|