Using Offset on Cell Address
endxrange is a string in the usage you show
endyrange = range(endxrange).Offset(1,0).Address
MsgBox "ending x cell is " & endxrange
MsgBox "ending y cell is " & endyrange
--
Regards,
Tom Ogilvy
"kfh105" wrote in message
om...
Let me preface this by stating that I'm relatively new to Excel macro
programming.
The following piece of code enables me to use Offset to get my
starting y-range. I'm searching for a specific string of text and what
to perform some data calculations on the two corresponding rows of
data, which start 2 & 3 rows below the located text respectively. (See
use of Offset below.)
--
Set Rng = Range("B4:B500").Find(What:="misctext", _
LookAt:=xlWhole, _
LookIn:=xlValues)
Dim selRngstart As Range
If Rng Is Nothing Then
MsgBox "Data Not Found"
Exit Sub
Else
' finding the starting point for data interpolation range
startxrange = Rng.Offset(2, 0).Address
startyrange = Rng.Offset(3, 0).Address
--
I tried using Offset in the following example, but it is not allowing
me to do it.
--
With ActiveCell
' Returns cell address of last cell in row (form of $F$9)
endxrange = Cells(.Row, Columns.Count).End(xlToLeft).Address
' endyrange = endxrange.Offset(1, 0).Address ****doesn't
work****
MsgBox "ending x cell is " & endxrange
' MsgBox "ending y cell is " & endxrange.Offset(1, 0).Address
End With
MsgBox "ending x cell is " & endxrange
' MsgBox "ending y cell is " & endyrange
--
Can anyone explain why this fails, when the prior example works as
expected? I've tried doing various Google Web & Groups searches to no
avail, although I assume I'm not searching for the right keywords. If
their is a resource that could help me out, I'd be most appreciative.
Thanks in advance for any assistance.
k
|