Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default Adding to cell ranges

Have this so far:

Dim CellRng as String
CellRng = "C4"

PercentVal = Sheets("Sheet1").Range(CellRng).Value

***Now, how can I add 1 row to CellRng. It's in loop, and I want it to get
the value for C5 next time.



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Adding to cell ranges

I am guessing you want to go from "C4" to "C5" to "C6", etc.
change
PercentVal = Sheets("Sheet1").Range(CellRng).Value
into
i = 3
j = 4
..
..
..
PercentVal = Sheets("Sheet1").Cells(j,i).Value

and then increment j in the loop to move downward.

An alternative is to use OFFSET()

--
Gary's Student


"Mike" wrote:

Have this so far:

Dim CellRng as String
CellRng = "C4"

PercentVal = Sheets("Sheet1").Range(CellRng).Value

***Now, how can I add 1 row to CellRng. It's in loop, and I want it to get
the value for C5 next time.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Adding to cell ranges

Another alternative is:
PercentVal = Sheets("Sheet1").Range("C" & j).Value
--
Gary''s Student


"Gary''s Student" wrote:

I am guessing you want to go from "C4" to "C5" to "C6", etc.
change
PercentVal = Sheets("Sheet1").Range(CellRng).Value
into
i = 3
j = 4
.
.
.
PercentVal = Sheets("Sheet1").Cells(j,i).Value

and then increment j in the loop to move downward.

An alternative is to use OFFSET()

--
Gary's Student


"Mike" wrote:

Have this so far:

Dim CellRng as String
CellRng = "C4"

PercentVal = Sheets("Sheet1").Range(CellRng).Value

***Now, how can I add 1 row to CellRng. It's in loop, and I want it to get
the value for C5 next time.



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
adding ranges [email protected] Excel Discussion (Misc queries) 2 November 21st 05 04:22 PM
adding ranges [email protected] Excel Programming 2 November 21st 05 02:39 PM
adding two ranges Monique Excel Programming 9 July 15th 05 04:25 PM
Adding ranges Bryan via OfficeKB.com Excel Programming 3 February 25th 05 03:06 AM
Adding Cell Values to Ranges Mike R Excel Programming 2 August 1st 03 09:37 AM


All times are GMT +1. The time now is 11:57 AM.

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"