ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   SORTING WORKSHEET TABS (https://www.excelbanter.com/excel-worksheet-functions/237167-sorting-worksheet-tabs.html)

Tree

SORTING WORKSHEET TABS
 
I need help with the VB project listed on Pearson's webpage for sorting and
ordering tabs within a worksheeet.

I tried to follow the directions given for other posters regarding this same
subject but I am missing something becasue I cannot get the macro to work.

First when I try it (by just copying the code straight from the webpage and
inserting into VB) - I do not get a macro at all to come up to select when I
click ALT F8 to bring up the macro dialog box. Once I insert the code that
"calls it up" as suggested by Dave Petersen in a post dated 7/15/08 which is
the following:

Option Explicit
Sub testme()
If SortWorksheetsByName(0, 0, "", False) = False Then
MsgBox "something bad happened"
Else
MsgBox "ok--check the sheets"
End If
End Sub


and then I press ALT F8 to run it - I get an error message saying that the
Compile Error - Sub or Function not defined...
and TestFirstLastSort is highlighted on this line (the one that starts with
B):

'''''''''''''''''''''''''''''''''''''''
' More than one sheet selected. We
' can sort only if the selected
' sheet are adjacent.
'''''''''''''''''''''''''''''''''''''''
B = TestFirstLastSort(FirstToSort, LastToSort, ErrorText)

so, obviously I am missing something.. I never have had this much trouble
copying and pasting any of the code so generously shared here on these forums
so I am sure it is definitely user error..

I appreciate any guidance that could be given!!
Thank you.





Tree

SORTING WORKSHEET TABS*NEVER MIND**
 
PLEASE.. Never mind! I figured it out.. I had neglected a very important
piece of Mr. Pearson's code that is provided at the bottom of the webpage..
once I had that, it worked like a charm!!!

THANK YOU!!!!!!!!!!!!!


"Tree" wrote:

I need help with the VB project listed on Pearson's webpage for sorting and
ordering tabs within a worksheeet.

I tried to follow the directions given for other posters regarding this same
subject but I am missing something becasue I cannot get the macro to work.

First when I try it (by just copying the code straight from the webpage and
inserting into VB) - I do not get a macro at all to come up to select when I
click ALT F8 to bring up the macro dialog box. Once I insert the code that
"calls it up" as suggested by Dave Petersen in a post dated 7/15/08 which is
the following:

Option Explicit
Sub testme()
If SortWorksheetsByName(0, 0, "", False) = False Then
MsgBox "something bad happened"
Else
MsgBox "ok--check the sheets"
End If
End Sub


and then I press ALT F8 to run it - I get an error message saying that the
Compile Error - Sub or Function not defined...
and TestFirstLastSort is highlighted on this line (the one that starts with
B):

'''''''''''''''''''''''''''''''''''''''
' More than one sheet selected. We
' can sort only if the selected
' sheet are adjacent.
'''''''''''''''''''''''''''''''''''''''
B = TestFirstLastSort(FirstToSort, LastToSort, ErrorText)

so, obviously I am missing something.. I never have had this much trouble
copying and pasting any of the code so generously shared here on these forums
so I am sure it is definitely user error..

I appreciate any guidance that could be given!!
Thank you.






All times are GMT +1. The time now is 06:38 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com