• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

VBA to search sheet by partial name and message box to go to next search if the right sheet name is not found

Status
Not open for further replies.
rlv01
Do You have any idea ...
if someone copy and paste that code,
how it can be different than original?
Of course, there are sometimes ... interesting (unwanted) features with Excel
... but this is the 1st time that I've read about this ( copied and pasted are different ).
If nothing in Personal.xlsb (dumb code) then it could be a bad add-in involved or Excel is broken / damaged : to see with your IT.​
Do no create any other VBA thread while this issue is not solved on your computer as we won't waste time anymore …​
View attachment 83782

That code works for me. but I notice that for you, the case of "inputbox" is wrong. The VBE editor should have automatically corrected the case of keyword "inputbox" to display "InputBox". That it did not suggests something unexplained is going on. As an experiment,change your code to use the Application InputBox instead of the VBA InputBox. In other words, replace this line:
Code:
S = InputBox(vbLf & vbLf & " Search for :", "Worksheet name"): If S = "" Then Exit Sub
with this:
Code:
S = Application.InputBox(vbLf & vbLf & " Search for :", "Worksheet name"): If S = "False" Then Exit Sub
and report back.

Thanks Rlv01, That worked. script is running asking for my input..plus I also googled on this issue which says to check the DIM Statements. So I removed the DIM S$ from the script.and it worked even without it. I cant say why it was not working earlier and its working now ,probably Changing Application.InputBox made it work

83788
 
As Dim has nothing to do with your issue except if it was containing 'inputbox' so your bad …​
Like said in your link : never use VBA reserved words for variables names (like for procedures names as well) !​
As InputBox alone is a VBA basics statement so it is absolutely abnormal it is not recognized in your VBE​
so if the same occurs in a brand new workbook without any dumb Dim codeline you will meet other issues …​
 
As Dim has nothing to do with your issue except if it was containing 'inputbox' so your bad …​
Like said in your link : never use VBA reserved words for variables names (like for procedures names as well) !​
As InputBox alone is a VBA basics statement so it is absolutely abnormal it is not recognized in your VBE​
so if the same occurs in a brand new workbook without any dumb Dim codeline you will meet other issues …​
thanks for the script. Its working now as designed. will report when defunct.
 
Status
Not open for further replies.
Back
Top