Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Dynamically select range

Hi-

I have a block of data, say A1:D10, and I have code that dynamically
selects what rows in column D I want to select. So one run may grab
D1:D6, and the next may grab D1:D8 depending on the
criteria....etc....

The problem I have is trying to select the entire block of data. So
if D1:D6 is selected, how do I then tell it to grab A1:D6? Currently
I use this code: Range(Selection,
Selection.End(xlToLeft)).Select....which is ok....until I get a break
in the range. So if column B is BLANK, the macro will only grab
columns C and D.

How do I tell the macro to grab an entire block of data, starting in
column A...and ending in the last row selected in column D??

Thanks,
Chris
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Dynamically select range

with sheets(Sheet1)
.range(.range("D1"), .cells(rows.count, "A").end(xlup)).select
end with
--
HTH...

Jim Thomlinson


"Fatz" wrote:

Hi-

I have a block of data, say A1:D10, and I have code that dynamically
selects what rows in column D I want to select. So one run may grab
D1:D6, and the next may grab D1:D8 depending on the
criteria....etc....

The problem I have is trying to select the entire block of data. So
if D1:D6 is selected, how do I then tell it to grab A1:D6? Currently
I use this code: Range(Selection,
Selection.End(xlToLeft)).Select....which is ok....until I get a break
in the range. So if column B is BLANK, the macro will only grab
columns C and D.

How do I tell the macro to grab an entire block of data, starting in
column A...and ending in the last row selected in column D??

Thanks,
Chris

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
dynamically select sheet swtrader Excel Programming 2 October 24th 06 09:50 PM
dynamically select a range of cells for use in a formula isofuncurves Excel Worksheet Functions 1 February 2nd 06 01:34 AM
How to dynamically select a validation list from data in a cell? sessc Excel Discussion (Misc queries) 1 July 28th 05 06:11 PM
Dynamically select a Printer Bill Agee Excel Programming 2 November 4th 04 02:03 PM
how to select cells dynamically in excel macro? Excel user Excel Programming 1 November 1st 04 05:28 PM


All times are GMT +1. The time now is 06:17 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"