Move Excel worksheet to last sheet of same workbook??

Hi All,

What I would have imagined would be a very simple point is proving a little annoying…

How do I simply script Excel to move a worksheet to the last sheet of the same workbook??

I would have thought that it would be an obvious ‘move’ command, but if I use that command it moves the sheet to a newly opened workbook!!

Why is it not working???

DDHawk



tell application "Microsoft Excel"
	move worksheet "Jan10Lessons" to last sheet of active workbook
end tell

Hi,

the move command is correct, you have to specify the exact insertion location


tell application "Microsoft Excel"
   move worksheet "Jan10Lessons" to after last sheet of active workbook -- (or before)
end tell

Sorry StefanK,

Rookie mistake!! Forgot about the ‘after’!!

Thanks for the help.

DDHawk