![]() |
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. |
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. |
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. |
All times are GMT +1. The time now is 11:15 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com