![]() |
Macro needed (like find)
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. |
Macro needed (like find)
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(Active Workbook.Worksheets.Count)) myWS.Name = r.Value End If End If Next r End Sub HTH, Barb Reinhardt "doral" wrote: 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. |
Macro needed (like find)
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. "Barb Reinhardt" wrote: 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(Active Workbook.Worksheets.Count)) myWS.Name = r.Value End If End If Next r End Sub HTH, Barb Reinhardt "doral" wrote: 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. |
All times are GMT +1. The time now is 08:24 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com