View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Display 007[_2_] Display 007[_2_] is offline
external usenet poster
 
Posts: 1
Default Clear columns or Drap Columns

I have a sheet with memory intensive calcs. I want the user to enter an
inout stipulating how many columns they are using. I then want a VBA macro
to either drap the columns to that number or conversely delete the columns
after that number.

Assum I have a row which has column counter in it D5:IV5 (i.e. D5 = 1 E5 = 2
etc). And further say the data I want to drag or delete is in D7:IV20. I
want the macro to look at the inputed number (say 10), find this number in
D5:IV5 (M5 or column M). If the current range of data is less than D7:M20,
(say D7:J20) then drag from D7:D20 to M7:M20. If the current range data are
more than D7:M20 (say D7:S20), then delete from S7:S20 to N7:N20.

The goal being to end up with a range which starts with D7 and ends with
approporiate column number you inputted (i.e. 10) - M20.

Does anyone know of an efficient way to do this?

Thanks

EM