View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Tree Tree is offline
external usenet poster
 
Posts: 41
Default 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.