Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have several sheets within a workbook. What I would like the program to do
is search through the sheet names and if there is a sheet name = to txtName.Value then perform action, otherwise show a message telling the user the input is not valid. I have already written the "then" and "else" portion of this code, but I don't have the slightest idea how to have the program search through the sheets to find the correct one (the "If"). Please help! |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Maybe something like:
Sub getname() Set txtName = Sheets("Sheet1").Range("A1") v = txtName.Value For Each sh In Sheets If sh.Name = v Then MsgBox ("FOUND IT!!") Exit Sub End If Next MsgBox ("did not find it.") End Sub -- Gary''s Student - gsnu200839 "Jacy Erdelt" wrote: I have several sheets within a workbook. What I would like the program to do is search through the sheet names and if there is a sheet name = to txtName.Value then perform action, otherwise show a message telling the user the input is not valid. I have already written the "then" and "else" portion of this code, but I don't have the slightest idea how to have the program search through the sheets to find the correct one (the "If"). Please help! |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You can do your test this way...
Dim TestName As String .... On Error Resume Next TestName = Sheets(txtName.Text).Name If Err.Number = 0 Then MsgBox "Exists" Else MsgBox "Doesn't exist" End If -- Rick (MVP - Excel) "Jacy Erdelt" wrote in message ... I have several sheets within a workbook. What I would like the program to do is search through the sheet names and if there is a sheet name = to txtName.Value then perform action, otherwise show a message telling the user the input is not valid. I have already written the "then" and "else" portion of this code, but I don't have the slightest idea how to have the program search through the sheets to find the correct one (the "If"). Please help! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
how to find duplicate entry in one sheet and in workbook | Excel Discussion (Misc queries) | |||
Designating Sheet vs Workbook When Doing Find/Replace | Excel Programming | |||
find workbook names that are in sheet | Excel Programming | |||
how can find sheet on workbook have so many sheet ? | Excel Worksheet Functions | |||
find replace within sheet or workbook | Excel Programming |