Move sheet using API

Hi Adrian

Is it possible to move a sheet within the workbook (i.e. change it's index) using the API. Have trawled the source but can't find anything.

Thanks, Bob

Hi,

Sadly no, there is currently no way to move a sheet. It is something in our interminable to-do list, but without much priority because it is not something that has been demanded much, and it isn't either trivial to do (when you move a sheet you have to move all references in formulas to that sheet, conditional formats, charts, whatever). Normally when we have a lot of demand for a feature or if there is not much demand but it is simple to implement we implement it quickly. When there is little demand and the feature is complex, it normally ends up being pushed back by other features that are either more demanded or simpler to implement.

Ok - thanks for both answers!

It may not be the most efficient, but would it not be possible to get the desired effect by doing an InsertCopySheets within the same workbook, and then delete the original sheet?

In the some cases that might work, but in general it won't. Imagine that I have Sheet1 and Sheet2, and in Sheet2 I have the formula =Sheet1!A1. I Copy Sheet1 to the end, and then delete Sheet1. Now the formula in Sheet2 (=Sheet1!A1) is invalid, because Sheet1 doesn't exist anymore. (even if we have a new Sheet1 after Sheet2)