Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm trying to use Offest with a variable as the row offset. When run,
the line does nothing. When I replace the variable with an integer, it works fine. Heres the code: ' This is where the variable is assigned a value If InStr(1, UCase(ActiveCell.Offset(0, i).Value), "HOURS") 0 Then HoursCol = ActiveCell.Offset(0, i).Column ' It then gets passed to this sub Public Sub FindWrapperTotals(...HoursCol As Integer, ...) ' Used he MsgBox ("HoursCol = " & HoursCol) HoursNum = ActiveCell.Offset(0, HoursCol - 1).Value MsgBox ("HoursNum = " & HoursNum) When run, the first message box says "HoursCol = 8", which is correct, and the second message box says "HoursNum = ". When I replace "HoursCol - 1" with an integer, it does exactly what I need...but of course, life isn't simple enough to always use integers. Thanks in advance for any advice. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
select offset (variable ,1) to offset(variable ,variable) | Excel Programming | |||
Offset with variable? | Excel Programming | |||
Offset with variable? | Excel Programming | |||
offset not working | Excel Discussion (Misc queries) | |||
Offset with variable | Excel Programming |