View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Toppers Toppers is offline
external usenet poster
 
Posts: 4,339
Default Build lists with non contiguous cells

Hi,
It looks OK - what is the value of EmptyColumn?

I tried with invalid value of EmptyColumn (0 & 257) and got expected "Run
Time error _ Application-Defined or object-defined error "



" wrote:

I am new to VBA for Excel, and I would appreciate any tips on how to
accomplish the following.

I have 5 columns with data. For example

Column one has titles (Range I:3:I37)
Column two has values for a start period (Range L3:L37)
Column three has values for an end period (Range M3:M37)
Column four has values for a different start period (Range O3:P37)
Column five has values for a different end period (Range P3:P37)

I need to build 2 columns on a different worksheet with the titles and
values, but the data I need to access in the ranges above is not
contiguous. I want to build the two columns so that users can build
scenarios for the different sets of data they input. They can press a
button and transfer their scenario to a different worksheet. An
example of how I might start to build my list of values is as follows:

Take the range of I4:M6, and then take only O6, and then L7, and then
L9:L10....

I created a macro and it runs slowly and seems to work for the first
iteration. After that when I try to process another scenario in my code
I get the error 'Run time error - Select method on range class failed'
on the following line:

Range(Cells(8, EmptyColumn), Cells(52, EmptyColumn)).Select

Any help would be greatly appreciated.

Thanks in advance,
Julia