View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Dirk Goldgar Dirk Goldgar is offline
external usenet poster
 
Posts: 3
Default Shift constant values in a range left or right by n columns

Hi, Excel folks -

Given a range containing some cells with constant values and some cells with
formulas, what is the most efficient way to shift only the constant values
left or right by a specified number of columns, leaving formulas and all
formatting in source and target cells unchanged? I'd also want to clear the
values in the cells from which the data has been moved.

What this is all about is a worksheet that contains columns representing
months of data, with the rows representing line items or various subtotals.
I want to advance or retreat the date window by a user-specified number of
months.

I've worked out how to do this by looping through the rows and columns of
the range, but (a) the code is slow, taking about several seconds to
execute, and (b) it seems to me this is not the "Excel" way to do this. I
feel like there ought to be a set of simple range operations to accomplish
it.

Can you advise me, please?

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)