Sheet Activation Macro with Inputbox

Hellow Experts,

I Have Following Code not working for Me Please Guide what is my mistake.

I have worrkbook which have sheet name like Annex (1) , Annex (2), Annex (3), ... i want to create macro where in input box i write sheet name and it activate that sheet for the purpose i have created that macro but not working Please guide.

Regards,  

Sub GotoWriteSheetName()

Dim MyVal As String

MyVal = InputBox("WriteSheetName", , "Annex(1)")
'On Error Resume Next

ThisWorkbook.Sheets(MyVal).Activate

End Sub

Open in new window

WiseOwl ExcelFinance ExxcutiveAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rob HensonFinance AnalystCommented:
Can you check the sheet names for spaces?

Your script has "Annex(1)" with no spaces, your description has "Annex (1)" with a space.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Martin LissOlder than dirtCommented:
Your code works for me. Maybe I don't understand what you mean by "Activate" so please tell me if the sheet to be activated is hidden or locked or???
WiseOwl ExcelFinance ExxcutiveAuthor Commented:
Sir Rob Henson,

I was unable to Locate error sometime the book you wrote you cannot look at error it was very simple code Error was for Space which you pointify Thanks.

Sir Martin Liss

i just review again with idea of Space that code worked for you  Thanks for Reply and Input Sir.

Regards
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VBA

From novice to tech pro — start learning today.