Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel VBA - determine location of a keyword

Hello Excel/VBA gurus,

I'm trying to create a script that would give me the row value of
cell containing a unique key word I am looking. I am thinking of
options to do this:

1. Select the column, then go through each rows in the column from u
to down and compare if the value of the row contains my keyword. I
not, go to the next row until the keyword is found.

2. Select the column. Use a VBA function, of which I don't know, t
find the keyword.

Once the row number of the keyword is found, assign the row numbe
before this as my last "valid" row.

Can someone help me with the codes for the two options above?

Thanks in advance for your help! :)
Sinobat

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Excel VBA - determine location of a keyword

Dim rng as Range
Dim lastRow as Long
set rng = Columns(1).Find("ABCD")
if not rng is nothing then
lastRow = rng.offset(-1,0).row
rng.offset(-1,0).Select
else
msgbox "ABCD not found"
End if

no reason to pursue method 1.

--
Regards,
Tom Ogilvy

"Sinobato " wrote in message
...
Hello Excel/VBA gurus,

I'm trying to create a script that would give me the row value of a
cell containing a unique key word I am looking. I am thinking of 2
options to do this:

1. Select the column, then go through each rows in the column from up
to down and compare if the value of the row contains my keyword. If
not, go to the next row until the keyword is found.

2. Select the column. Use a VBA function, of which I don't know, to
find the keyword.

Once the row number of the keyword is found, assign the row number
before this as my last "valid" row.

Can someone help me with the codes for the two options above?

Thanks in advance for your help! :)
Sinobato


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel VBA - determine location of a keyword

Tom, thanks for your help!

Regards,
Sinobat

--
Message posted from http://www.ExcelForum.com

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
How to determine cursor location? Dan Excel Discussion (Misc queries) 4 March 12th 09 03:11 PM
How to determine the cell location? Eric Excel Worksheet Functions 2 March 6th 09 03:51 AM
Macro - save to current location vs excel default location leezard Excel Discussion (Misc queries) 0 October 28th 08 03:04 PM
Excel 2000 Help File - What keyword Martin Folley Excel Discussion (Misc queries) 3 June 30th 06 05:05 PM
Determine the location of an external source of pivot table? Pivot Novice Excel Worksheet Functions 3 June 1st 05 09:34 PM


All times are GMT +1. The time now is 09:50 PM.

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"