Excel VBA Cell Value

p0lish

Gawd
Joined
Sep 11, 2002
Messages
642
I'm super rusty at coding, so please bear with me! I want to have some VBA code read a cell value from a different page in the same workbook, and set that value to a 'double' to run some additional calculations. The goal is to read from a row/column location in a loop, increase the counter and read from the same column, next row down. (IE G4-G5-G6-G7) For example, i currently want to set Hrs = Cell P3 on "Enter Sheet" There's something wrong with the below code correct?

Hrs = Sheets("ENTER SHEET").Cells(p, PNum)

Pnum has been set = 3, with a +1 counter everytime the loop runs (Start at P3, then P4/P5/P6, ect)

If the value of P3 was 3.5, that i want Hrs = 3.5. I'm sure i'm missing something obvious, but i've been googling for awhile with no luck. Thanks for your time!
 
I think you have your coordinates backwards and you need the Value field, .Cells(row, col).Value

Also, p in your case is 16.
 
Back
Top