Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am using Excel 97.
Can anyone assist me please? I am wanting some code which with the use of an input box searches all the worksheets in a workbook for a sheet with that value. A user can enter either a name of a numerical value and the worksheets are checked, if no worksheet is found then a new sheet is created with the name of the value of the input box. I have something similar in place at the moment but it doesn't always work correctly as some of the worksheets have similar names! Any offers? Thanks Mark |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
mark copy the code into this post so that we can have a look it may just
be simple case of change part of the code, Save all of us a bit of time --- Message posted from http://www.ExcelForum.com/ |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
blnExists = False
For a = 1 To Sheets.Count If Sheets(a).Name = strInputName Then blnExists = True Next If blnExists = False Then Sheets.Add Sheets(Sheets.Count).Name = strInputName Else Sheets(strInputName).Select End If Cheers, Jeff "Mark" wrote in message ... I am using Excel 97. Can anyone assist me please? I am wanting some code which with the use of an input box searches all the worksheets in a workbook for a sheet with that value. A user can enter either a name of a numerical value and the worksheets are checked, if no worksheet is found then a new sheet is created with the name of the value of the input box. I have something similar in place at the moment but it doesn't always work correctly as some of the worksheets have similar names! Any offers? Thanks Mark |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Not sure if it's clear or not that strInputName is what your InputBox
returns. Jeff "Jeff Standen" wrote in message ... blnExists = False For a = 1 To Sheets.Count If Sheets(a).Name = strInputName Then blnExists = True Next If blnExists = False Then Sheets.Add Sheets(Sheets.Count).Name = strInputName Else Sheets(strInputName).Select End If Cheers, Jeff "Mark" wrote in message ... I am using Excel 97. Can anyone assist me please? I am wanting some code which with the use of an input box searches all the worksheets in a workbook for a sheet with that value. A user can enter either a name of a numerical value and the worksheets are checked, if no worksheet is found then a new sheet is created with the name of the value of the input box. I have something similar in place at the moment but it doesn't always work correctly as some of the worksheets have similar names! Any offers? Thanks Mark |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Here's my code:
Sub GoToBadge() NameNumber = InputBox(prompt:="Enter Name or Number") On Error GoTo NewName ' this on error causes a fail to find to go to create a new record Worksheets(NameNumber).Activate ' this find goes to first empty cell in leave record FindEmptyCell Exit Sub NewName: On Error GoTo FINISH If DialogSheets("GetNumDialog").Show Then EmpType Newsheet = ActiveSheet.Name Worksheets(Newsheet).Name = NameNumber Cells(4, "C").Value = NameNumber OfficerName = InputBox(prompt:="Enter Name") Cells(4, 1).Value = FullName StartDate = InputBox(prompt:="Enter Date Joining, DD/MM/YYYY") Cells(2, 2).Value = CDate(StartDate) Resume Else End If FINISH: End Sub -----Original Message----- I am using Excel 97. Can anyone assist me please? I am wanting some code which with the use of an input box searches all the worksheets in a workbook for a sheet with that value. A user can enter either a name of a numerical value and the worksheets are checked, if no worksheet is found then a new sheet is created with the name of the value of the input box. I have something similar in place at the moment but it doesn't always work correctly as some of the worksheets have similar names! Any offers? Thanks Mark . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Searching worksheet and exporting name to other sheet | Excel Discussion (Misc queries) | |||
Searching for data and placing in new worksheet | Excel Worksheet Functions | |||
Searching numbers in Worksheet | Excel Worksheet Functions | |||
Searching numbers in Worksheet? | Excel Worksheet Functions | |||
Searching numbers in Worksheet? | Excel Worksheet Functions |