Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Build lists with non contiguous cells

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Non-contiguous cells Kokomojo Excel Discussion (Misc queries) 2 November 6th 07 04:09 PM
Subtotal Non-contiguous cells David N. Ballew Jr. Excel Discussion (Misc queries) 3 May 2nd 07 07:30 PM
counting cells that are 0 in a range of non-contiguous cells Mark Excel Worksheet Functions 9 March 14th 07 02:45 PM
Testing for contiguous cells jamieuk Excel Programming 2 January 8th 04 05:23 PM
How to build build a macro that automatically imports PedroPeso Excel Programming 1 December 26th 03 08:14 PM


All times are GMT +1. The time now is 08:36 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"