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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel Worksheet positioning

Status
Not open for further replies.

flynbye

Programmer
Nov 16, 2001
68
US
I know that this is probably not difficult since I have found some reference to the Excel .move method but I'm having problems with positioning a newly created worksheet. Anyone have a quick example of how to move a worksheet available?

Thanks!


I always makes things much harder than they should be... that way later I can slap myself in the forhead after spending hours and hours on two lines of code and say to myself "DUH!"
 
Do you want to move it to another file or order the tabs differently in the same file?

Regards, Ruffnekk
---
Basic Instructions Before Leaving Earth (B.I.B.L.E.)
 
If you know the worksheet tab to insert it by you can make that tab active before the insert.
Code:
Dim oXL As Excel.Application
Dim oWB As Excel.Workbook
Dim oSheet As Excel.Worksheet
oXL = CreateObject("Excel.Application")
oXL.Visible = True
oWB = oXL.Workbooks.Open("Temp.xls")
oSheet = oWB.Worksheets("My Tab")
oSheet.Activesheet
' move here
I hope this helps.
djj
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top