rohan8510
08-15-2015, 04:04 AM
hi I have this code from excel.com but how do I just search the sheet and select it through input box also is there any way the input box remains always in the sheet and does not go away requesting your help many thanks
Sub Macro()
Dim strNewName As String
Dim ws As Worksheet
Dim boolFound As Boolean
strNewName = InputBox("Please enter a valid Worksheet Name:", "New Worksheet Name")
For Each ws In Worksheets
If ws.Name Like strNewName Then boolFound = True: Exit For
Next
If boolFound = True Then
MsgBox ("Name Already Exisits, Please enter a new name")
Sheets(strNewName).Select
Else
Sheets.Add.Name = strNewName
End If
End Sub
Sub Macro()
Dim strNewName As String
Dim ws As Worksheet
Dim boolFound As Boolean
strNewName = InputBox("Please enter a valid Worksheet Name:", "New Worksheet Name")
For Each ws In Worksheets
If ws.Name Like strNewName Then boolFound = True: Exit For
Next
If boolFound = True Then
MsgBox ("Name Already Exisits, Please enter a new name")
Sheets(strNewName).Select
Else
Sheets.Add.Name = strNewName
End If
End Sub