Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 788
Default Selecting a Range using a variable

I am using a For-Next loop to step through several rows of excel data. I
have set i to be the variable for the row number. When a given set of data
meets the criteria I have defined with an If-Then statement I would like to
select a Range of data in that row. My question is how do I select this
range? (Ex: ActiveSheet.Range("Ai:Di").Select obviously does not work. How
do I code the Range statement to select the cells between columns A and D of
row variable i?)
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 644
Default Selecting a Range using a variable

Range("A" & i & ":D" & i).Select

HTH

Charles Chickering
Chris wrote:
I am using a For-Next loop to step through several rows of excel data. I
have set i to be the variable for the row number. When a given set of data
meets the criteria I have defined with an If-Then statement I would like to
select a Range of data in that row. My question is how do I select this
range? (Ex: ActiveSheet.Range("Ai:Di").Select obviously does not work. How
do I code the Range statement to select the cells between columns A and D of
row variable i?)


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Selecting a Range using a variable

activesheet.range("a" & I).resize(1,4).select
or
activesheet.cells(i, "a").resize(1,4).select

could be used, too.

Chris wrote:

I am using a For-Next loop to step through several rows of excel data. I
have set i to be the variable for the row number. When a given set of data
meets the criteria I have defined with an If-Then statement I would like to
select a Range of data in that row. My question is how do I select this
range? (Ex: ActiveSheet.Range("Ai:Di").Select obviously does not work. How
do I code the Range statement to select the cells between columns A and D of
row variable i?)


--

Dave Peterson
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
selecting Variable range katmando[_10_] Excel Programming 4 May 18th 06 09:51 AM
Selecting a variable range Dan Excel Programming 2 November 2nd 04 06:02 AM
Selecting a variable range Colin Foster[_3_] Excel Programming 3 October 26th 04 11:02 PM
Selecting a variable Range Brett[_6_] Excel Programming 1 September 9th 04 02:46 AM
Selecting a Range Using a Variable Bob J. Excel Programming 4 September 14th 03 09:24 PM


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