Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9
Default Do Loop or use End iF for search string

50 colums (BI:DC) 1500 rows (500 to 2000)
On the cs772nd row, cs797th row, cs822nd row and so on, in each column I
have the word "stop".
The data is already stored or I am storing data into these colums:

Depending on where I am storing data, I would like to search that column for
the word stop, and I want my active cell to be just above the word stop.

SO If I am in CU775 (Activecell) than I would like to search that column CU
for the word stop down to row 797 and my active cell would be CU796.

What would be the best way for me to approach this with not too much coding
as I need to accomodate this to another marco already in place.

Thanks,
Rick

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,646
Default Do Loop or use End iF for search string

Try this:

Cells(Columns(ActiveCell.Column).Find(What:="stop" , _
After:=ActiveCell, LookIn:=xlValues, _
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Row - 1, ActiveCell.Column).Select

You may have to apply On Error for handling cases when "stop" is not found!

Regards,
Stefi

€˛RGreen€¯ ezt Ć*rta:

50 colums (BI:DC) 1500 rows (500 to 2000)
On the cs772nd row, cs797th row, cs822nd row and so on, in each column I
have the word "stop".
The data is already stored or I am storing data into these colums:

Depending on where I am storing data, I would like to search that column for
the word stop, and I want my active cell to be just above the word stop.

SO If I am in CU775 (Activecell) than I would like to search that column CU
for the word stop down to row 797 and my active cell would be CU796.

What would be the best way for me to approach this with not too much coding
as I need to accomodate this to another marco already in place.

Thanks,
Rick

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,520
Default Do Loop or use End iF for search string

Try the below macro

Sub Macro()
Dim varFound As Variant
Set varFound = Columns(ActiveCell.Column).Find("Stop")
If Not varfound Is Nothing Then varfound.Offset(-1, 0).Activate
End Sub


If this post helps click Yes
---------------
Jacob Skaria


"RGreen" wrote:

50 colums (BI:DC) 1500 rows (500 to 2000)
On the cs772nd row, cs797th row, cs822nd row and so on, in each column I
have the word "stop".
The data is already stored or I am storing data into these colums:

Depending on where I am storing data, I would like to search that column for
the word stop, and I want my active cell to be just above the word stop.

SO If I am in CU775 (Activecell) than I would like to search that column CU
for the word stop down to row 797 and my active cell would be CU796.

What would be the best way for me to approach this with not too much coding
as I need to accomodate this to another marco already in place.

Thanks,
Rick

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,520
Default Do Loop or use End iF for search string

Oops...correction..

Sub Macro()
Dim varFound As Variant
Set varFound = Range(ActiveCell, Cells(Rows.Count, _
ActiveCell.Column).End(xlUp)).Find("Stop")
If Not varFound Is Nothing Then varFound.Offset(-1, 0).Activate
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"Jacob Skaria" wrote:

Try the below macro

Sub Macro()
Dim varFound As Variant
Set varFound = Columns(ActiveCell.Column).Find("Stop")
If Not varfound Is Nothing Then varfound.Offset(-1, 0).Activate
End Sub


If this post helps click Yes
---------------
Jacob Skaria


"RGreen" wrote:

50 colums (BI:DC) 1500 rows (500 to 2000)
On the cs772nd row, cs797th row, cs822nd row and so on, in each column I
have the word "stop".
The data is already stored or I am storing data into these colums:

Depending on where I am storing data, I would like to search that column for
the word stop, and I want my active cell to be just above the word stop.

SO If I am in CU775 (Activecell) than I would like to search that column CU
for the word stop down to row 797 and my active cell would be CU796.

What would be the best way for me to approach this with not too much coding
as I need to accomodate this to another marco already in place.

Thanks,
Rick

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9
Default Do Loop or use End iF for search string

Hey Jacob, this did the trick

Stefi, haven't tried it yet, but thanks for the posting.

Rick.

"Jacob Skaria" wrote:

Try the below macro

Sub Macro()
Dim varFound As Variant
Set varFound = Columns(ActiveCell.Column).Find("Stop")
If Not varfound Is Nothing Then varfound.Offset(-1, 0).Activate
End Sub


If this post helps click Yes
---------------
Jacob Skaria


"RGreen" wrote:

50 colums (BI:DC) 1500 rows (500 to 2000)
On the cs772nd row, cs797th row, cs822nd row and so on, in each column I
have the word "stop".
The data is already stored or I am storing data into these colums:

Depending on where I am storing data, I would like to search that column for
the word stop, and I want my active cell to be just above the word stop.

SO If I am in CU775 (Activecell) than I would like to search that column CU
for the word stop down to row 797 and my active cell would be CU796.

What would be the best way for me to approach this with not too much coding
as I need to accomodate this to another marco already in place.

Thanks,
Rick

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
search string for number value samuel Excel Discussion (Misc queries) 3 May 13th 08 10:05 PM
How to search a string from the right ? EuroMaverick Setting up and Configuration of Excel 2 March 28th 07 09:20 PM
to search for a string and affect data if it finds the string? Shwaman Excel Worksheet Functions 1 January 11th 06 12:56 AM
SUMPRODUCT and search string peacelittleone Excel Worksheet Functions 5 June 15th 05 03:24 PM
Q: search in string JIM.H. Excel Discussion (Misc queries) 5 January 5th 05 10:24 PM


All times are GMT +1. The time now is 05:38 PM.

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"