Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have this code:
Sub Subtotals() Dim SubTot As Integer Dim Line1 As Double Sheets("Temp").Select Range("H2").Select Line1 = Range("L2") SubTot = Range("P4") Do Until ActiveCell = ("Condiments") SubTot = Line1 + SubTot ActiveCell.Offset(1, 0).Select Line1 = Range.Offset(1, 0) 'Fails on this line!!! Range("P4") = SubTot Loop Can anyone please help me on being able to step my varible "Line1" down a row?? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
try
set line1 = line1.offset(1,0) or line1=line1.offset(1,0) "Ashley Milford via OfficeKB.com" wrote: I have this code: Sub Subtotals() Dim SubTot As Integer Dim Line1 As Double Sheets("Temp").Select Range("H2").Select Line1 = Range("L2") SubTot = Range("P4") Do Until ActiveCell = ("Condiments") SubTot = Line1 + SubTot ActiveCell.Offset(1, 0).Select Line1 = Range.Offset(1, 0) 'Fails on this line!!! Range("P4") = SubTot Loop Can anyone please help me on being able to step my varible "Line1" down a row?? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
thank gixxer but both of them say that the line1 in the [] are invaild
qualifiers. the code won't even compile it goes straight to the []'s. also no i didn't put the [] in the code. set line1 = [line1].offset(1,0) line1=[line1].offset(1,0) |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
wait, line1 is dimmed as a double so it can't be modified like that
try dimming line1 as range Sub Subtotals() Dim SubTot As Integer Dim Line1 As Range Sheets("Temp").Select Range("H2").Select set Line1 = Range("L2") SubTot = Range("P4") Do Until ActiveCell = ("Condiments") SubTot = Line1 + SubTot ' may need to do SubTot = Line1.value + SubTot ActiveCell.Offset(1, 0).Select set Line1 = Line1.Offset(1, 0) Range("P4") = SubTot Loop "Ashley Milford via OfficeKB.com" wrote: thank gixxer but both of them say that the line1 in the [] are invaild qualifiers. the code won't even compile it goes straight to the []'s. also no i didn't put the [] in the code. set line1 = [line1].offset(1,0) line1=[line1].offset(1,0) |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
gixxer,
Tried that, worked but it would not offset the line1 cell. it looped till the active cell was = to "Condiments" but only added the value of "L2" to the subtot instead of offsetting it to the row below every loop. Ashley |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hard to know what you are trying to do with Line1, but your problem is the
Use of Range. I have substituted ActiveCell which should work for eliminating the error, but don't know it is provides the functionality you want. Sub Subtotals() Dim SubTot As Integer Dim Line1 As Double Sheets("Temp").Select Range("H2").Select Line1 = Range("L2") SubTot = Range("P4") Do Until ActiveCell = ("Condiments") SubTot = Line1 + SubTot ActiveCell.Offset(1, 0).Select Line1 = ActiveCell.Offset(1, 0) 'Fails on this line!!! Range("P4") = SubTot Loop -- Regards, Tom Ogilvy "Ashley Milford via OfficeKB.com" wrote in message ... thank gixxer but both of them say that the line1 in the [] are invaild qualifiers. the code won't even compile it goes straight to the []'s. also no i didn't put the [] in the code. set line1 = [line1].offset(1,0) line1=[line1].offset(1,0) |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
same varible in formula | Excel Worksheet Functions | |||
varible calculation | New Users to Excel | |||
Range name as varible | Excel Programming | |||
Varible in a Range | Excel Programming | |||
how to start from varible row | Excel Programming |