Macro needed (like find)

D

doral

I have a drop down list of names, and I need the macro to find the name
selected within the workbook. The names that are found would be on
individual sheets. Could this be created? Thank you.
 
B

Barb Reinhardt

Where are the dropdown lists of names found? Let's say it's in cells B1:B10

Sub test()
Dim myRange As Range
Dim r As Range
Dim myWS As Worksheet
Set myRange = ActiveSheet.Range("B1:B10")
For Each r In myRange
If Len(r.Value) > 0 Then
Set myWS = Nothing
On Error Resume Next
Set myWS = ActiveWorkbook.Worksheets(r.Value) '<~~may want to check
this syntax
On Error GoTo 0
If myWS Is Nothing Then
Set myWS =
Worksheets.Add(after:=ActiveWorkbook.Sheets(ActiveWorkbook.Worksheets.Count))
myWS.Name = r.Value
End If
End If
Next r

End Sub


HTH,
Barb Reinhardt
 
D

doral

This didn't work. What I want to do say. I have a list a through d on first
sheet. Then I have 4 other sheets with a on one, b on one, etc to d. I want
to select from a drop down list a letter, say d, then have a textbox with a
macro assigned to it which would then find that letter in the other 4 sheets
(a through d). So after you would run the macro, it would go to sheet d.
 
Top