Sorry, I did not test that part of the code - nor did you ;-)) Sub Go2sheet() myShts = ActiveWorkbook.Sheets.Count For i = 1 To myShts myList = myList & i & " - " & ActiveWorkbook.Sheets(i).Name & " " & vbCr Next i Dim mySht mySht = InputBox("Select sheet no to copy data for report." & vbCr & vbCr & myList) If Not IsNumeric(mySht) Then Exit Sub Sheets(CInt(mySht)).Select End Sub
Daniel -----Message d'origine----- De : excel-macros@googlegroups.com [mailto:excel-mac...@googlegroups.com] De la part de Rajesh K R Envoyé : lundi 6 décembre 2010 17:13 À : excel-macros@googlegroups.com Objet : Re: $$Excel-Macros$$ error in macro hi Danial Thanks for ur reply i tried ur code but it shows other error (subscript out of range) when selecting the page. pls tell me how to solve it. Regards Rajesh On 12/6/10, Daniel <dcolarde...@free.fr> wrote: > Hello, > Try : > > Sub Go2sheet() > myShts = ActiveWorkbook.Sheets.Count > For i = 1 To myShts > myList = myList & i & " - " & ActiveWorkbook.Sheets(i).Name & " " & > vbCr Next i Dim mySht mySht = InputBox("Select sheet no to copy data > for report." & vbCr & vbCr & > myList) > If Not IsNumeric(mySht) Then Exit Sub > Sheets(mySht).Select > End Sub > > Regards. > Daniel > > -----Message d'origine----- > De : excel-macros@googlegroups.com > [mailto:excel-mac...@googlegroups.com] De la part de Rajesh K R Envoyé > : dimanche 5 décembre 2010 11:31 À : excel-macros Objet : > $$Excel-Macros$$ error in macro > > Hi Experts, > How to solve my problem regarding run time error > > Sub Go2sheet() > myShts = ActiveWorkbook.Sheets.Count > For i = 1 To myShts > myList = myList & i & " - " & ActiveWorkbook.Sheets(i).Name & " " & > vbCr Next i Dim mySht As Single mySht = InputBox("Select sheet no to > copy data for report." & vbCr & vbCr & myList) Sheets(mySht).Select > End If End sub > > when i run the code if i exit the macro it show error no 13. i want to > add a condition in it if input box <>"" then select sheet else end > macro > > Regards > Rajesh > > -- > ---------------------------------------------------------------------- > ------ > ------ > Some important links for excel users: > 1. Follow us on TWITTER for tips tricks and links : > http://twitter.com/exceldailytip 2. Join our LinkedIN group @ > http://www.linkedin.com/groups?gid=1871310 > 3. Excel tutorials at http://www.excel-macros.blogspot.com > 4. Learn VBA Macros at http://www.quickvba.blogspot.com 5. Excel Tips > and Tricks at http://exceldailytip.blogspot.com > > To post to this group, send email to excel-macros@googlegroups.com > > <><><><><><><><><><><><><><><><><><><><><><> > Like our page on facebook , Just follow below link > http://www.facebook.com/pages/discussexcelcom/160307843985936?v=wall&r > ef=ts > > -- > ---------------------------------------------------------------------- > ------------ > Some important links for excel users: > 1. Follow us on TWITTER for tips tricks and links : > http://twitter.com/exceldailytip > 2. Join our LinkedIN group @ > http://www.linkedin.com/groups?gid=1871310 > 3. Excel tutorials at http://www.excel-macros.blogspot.com > 4. Learn VBA Macros at http://www.quickvba.blogspot.com 5. Excel Tips > and Tricks at http://exceldailytip.blogspot.com > > To post to this group, send email to excel-macros@googlegroups.com > > <><><><><><><><><><><><><><><><><><><><><><> > Like our page on facebook , Just follow below link > http://www.facebook.com/pages/discussexcelcom/160307843985936?v=wall&r > ef=ts > -- ---------------------------------------------------------------------------- ------ Some important links for excel users: 1. Follow us on TWITTER for tips tricks and links : http://twitter.com/exceldailytip 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 3. Excel tutorials at http://www.excel-macros.blogspot.com 4. Learn VBA Macros at http://www.quickvba.blogspot.com 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com <><><><><><><><><><><><><><><><><><><><><><> Like our page on facebook , Just follow below link http://www.facebook.com/pages/discussexcelcom/160307843985936?v=wall&ref=ts -- ---------------------------------------------------------------------------------- Some important links for excel users: 1. Follow us on TWITTER for tips tricks and links : http://twitter.com/exceldailytip 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 3. Excel tutorials at http://www.excel-macros.blogspot.com 4. Learn VBA Macros at http://www.quickvba.blogspot.com 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com <><><><><><><><><><><><><><><><><><><><><><> Like our page on facebook , Just follow below link http://www.facebook.com/pages/discussexcelcom/160307843985936?v=wall&ref=ts