Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Referencing a cell address in the Offset formla | Excel Worksheet Functions | |||
Pass Cell Address to OFFSET | Excel Worksheet Functions | |||
SUM, OFFSET and CELL("address") | Excel Worksheet Functions | |||
Offset with Cell("address") | Excel Worksheet Functions | |||
Passing Cell Address to Offset | Excel Worksheet Functions |