#1   Report Post  
Posted to microsoft.public.excel.misc
Hirsch
 
Posts: n/a
Default Macros 101,

I am trying to locate a specific string of letters and go either up down
left or right of this string of letters and do some calculations.

for example.

find "Grand Total"
drop down one line and enter in this formula, then drop down one line and to
the right and enter in this formula.

(my problem is when the string of letters "Grand Total" floats from line 50
to line 60
  #2   Report Post  
Posted to microsoft.public.excel.misc
Bob Phillips
 
Posts: n/a
Default Macros 101,

If it is one column that you will look in, you could use

On Error Resume Next
iRow = Application.Match("Grand Total, Range("A:A"),0)
On Error Goto 0
If iRow 0 Then 'found
Cells(iRow,"A").Offset(1,0).Formula = ??
Cells(iRow,"A").Offset(1,1).Formula = ??
...

If it is multi-column, take a look at Find in VBA Help.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Hirsch" wrote in message
...
I am trying to locate a specific string of letters and go either up down
left or right of this string of letters and do some calculations.

for example.

find "Grand Total"
drop down one line and enter in this formula, then drop down one line and

to
the right and enter in this formula.

(my problem is when the string of letters "Grand Total" floats from line

50
to line 60



  #3   Report Post  
Posted to microsoft.public.excel.misc
Hirsch
 
Posts: n/a
Default Macros 101,

Bob, is there any formula similar to

Cells.offset(1,0).activate

I think this offset function could work, but I'm not familiar enough with it.




"Bob Phillips" wrote:

If it is one column that you will look in, you could use

On Error Resume Next
iRow = Application.Match("Grand Total, Range("A:A"),0)
On Error Goto 0
If iRow 0 Then 'found
Cells(iRow,"A").Offset(1,0).Formula = ??
Cells(iRow,"A").Offset(1,1).Formula = ??
...

If it is multi-column, take a look at Find in VBA Help.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Hirsch" wrote in message
...
I am trying to locate a specific string of letters and go either up down
left or right of this string of letters and do some calculations.

for example.

find "Grand Total"
drop down one line and enter in this formula, then drop down one line and

to
the right and enter in this formula.

(my problem is when the string of letters "Grand Total" floats from line

50
to line 60




  #4   Report Post  
Posted to microsoft.public.excel.misc
Bob Phillips
 
Posts: n/a
Default Macros 101,

You can't activate a cell from a formula, the nearest you get is that you
can point to another cell. Is that what you mean?

ActiveCell.Formula = "=" & ActiveCell.Offset(1, 0).Address(, , xlA1)

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Hirsch" wrote in message
...
Bob, is there any formula similar to

Cells.offset(1,0).activate

I think this offset function could work, but I'm not familiar enough with

it.




  #5   Report Post  
Posted to microsoft.public.excel.misc
Hirsch
 
Posts: n/a
Default Macros 101,

Bob - Thank you

To be Crude you're a Freak'n Genius - If I could have you sitting over my
shoulder all of the time I would.

The final formula that I used was:

Cells.Find(What:="Grand Total", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate

ActiveCell.Offset(1, 0).Activate

ActiveSheet.Paste

Thank you - Thank you very much

Hirsch

"Bob Phillips" wrote:

You can't activate a cell from a formula, the nearest you get is that you
can point to another cell. Is that what you mean?

ActiveCell.Formula = "=" & ActiveCell.Offset(1, 0).Address(, , xlA1)

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Hirsch" wrote in message
...
Bob, is there any formula similar to

Cells.offset(1,0).activate

I think this offset function could work, but I'm not familiar enough with

it.





Reply
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
Excel crashes while opening excel file imbeddied with macros ct2147 Excel Discussion (Misc queries) 0 December 30th 05 09:05 PM
Purge macros Don_S Excel Worksheet Functions 1 August 16th 05 03:51 PM
Enabling macros Peter M Excel Discussion (Misc queries) 3 February 7th 05 10:57 PM
Transferring toolbars and macros to other computers Darrell Excel Discussion (Misc queries) 1 January 19th 05 12:21 AM
The available macros list in XL; how to suppress filename from showing KR Excel Discussion (Misc queries) 1 January 10th 05 07:20 PM


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

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

About Us

"It's about Microsoft Excel"