LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Using Offset on Cell Address

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
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Referencing a cell address in the Offset formla Highlystrung Excel Worksheet Functions 3 November 13th 08 09:42 PM
Pass Cell Address to OFFSET ExcelGuy555 Excel Worksheet Functions 3 August 18th 07 07:42 AM
SUM, OFFSET and CELL("address") Quizarate Excel Worksheet Functions 7 August 17th 05 07:18 PM
Offset with Cell("address") James W. Excel Worksheet Functions 1 December 7th 04 08:39 PM
Passing Cell Address to Offset Bob Excel Worksheet Functions 2 December 1st 04 04:56 PM


All times are GMT +1. The time now is 09:03 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"