Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel .Move after:

Status
Not open for further replies.

thegameoflife

Programmer
Dec 5, 2001
206
0
0
US
What needs to be done here to make it work??? (move after)

Code:
With ActiveWorkbook
    
    .Sheets(rgn2(lp) & "_Top_10_Spec_Sum").Select
    
        With ActiveWorkbook.Sheets
                    
            .Move after:=Sheets(rgn2(lp) & "_Top_10_PCP_Sum")
            
         End With
    
    ActiveWindow.ScrollWorkbookTabs Sheets:=-1
    Sheets(rgn2(lp) & "_Top_10_PCP_Sum").Select
    
End With
 
Not exactly sure about what your function rgn2(lp) does, but assume it returns a string containing a region ID or some such. In that case, the following executes without error:

======================================================
Code:
Sub test()
Dim lp As Integer
With ActiveWorkbook
    .Sheets(rgn2(lp) & "_Top_10_Spec_Sum") _
       .Move after:=Worksheets(rgn2(lp) & "_Top_10_PCP_Sum")
    ActiveWindow.ScrollWorkbookTabs Sheets:=-1
    Sheets(rgn2(lp) & "_Top_10_PCP_Sum").Select
End With
End Sub
=======================================================

Hope that helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top