Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 37
Default Find Last Instance of "Text" in a column

I have a sorted column of text that I want to find the last instance
where the text begins with an asterisk ("*"). I can use this code to
do the search, but I would have to know how many times to "continue the
search". Also, the "~*" will also find any word with the asterisk in
it, while I only want those words with the asterisk as the first
character.


Columns("C:C").Select
Selection.Find(What:="~*", After:=ActiveCell, LookIn:=xlFormulas,
LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:= _
False, SearchFormat:=False).Activate
Selection.FindNext(After:=ActiveCell).Activate




--

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 747
Default Find Last Instance of "Text" in a column

try this

just change matchcase:=False to matchcase:=True



On Jan 7, 11:26*pm, "Chris Premo" wrote:
I have a sorted column of text that I want to find the last instance
where the text begins with an asterisk ("*"). *I can use this code to
do the search, but I would have to know how many times to "continue the
search". *Also, the "~*" will also find any word with the asterisk in
it, while I only want those words with the asterisk as the first
character.

* * Columns("C:C").Select
* * Selection.Find(What:="~*", After:=ActiveCell, LookIn:=xlFormulas,
LookAt _
* * * * :=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:= _
* * * * False, SearchFormat:=False).Activate
* * Selection.FindNext(After:=ActiveCell).Activate

--


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 37
Default Find Last Instance of "Text" in a column

muddan madhu wrote:

try this

just change matchcase:=False to matchcase:=True


No help, but thanks any way.


--

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,651
Default Find Last Instance of "Text" in a column

On Wed, 07 Jan 2009 10:26:52 -0800, "Chris Premo" wrote:

I have a sorted column of text that I want to find the last instance
where the text begins with an asterisk ("*"). I can use this code to
do the search, but I would have to know how many times to "continue the
search". Also, the "~*" will also find any word with the asterisk in
it, while I only want those words with the asterisk as the first
character.


Columns("C:C").Select
Selection.Find(What:="~*", After:=ActiveCell, LookIn:=xlFormulas,
LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:= _
False, SearchFormat:=False).Activate
Selection.FindNext(After:=ActiveCell).Activate



If by "last instance" you mean the instance in the highest numbered row in
Column C, and if you mean that the first character in the cell should be an
asterisk, then try this:

==========================
Sub LastAsterisk()
Dim r As Range
Set r = Columns(3).Find(what:="~**", _
after:=Range("C1"), _
lookat:=xlWhole, _
searchdirection:=xlPrevious)

Debug.Print r.Address
End Sub
====================

--ron
  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 37
Default Find Last Instance of "Text" in a column

Ron Rosenfeld wrote:

That worked. Thanks!



--



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,651
Default Find Last Instance of "Text" in a column

On Wed, 07 Jan 2009 12:05:36 -0800, "Chris Premo" wrote:

Ron Rosenfeld wrote:

That worked. Thanks!



Glad to help. Thanks for the feedback.
--ron
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 - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
How do I change the column heading in Excel to display "A" "B" "C Thai New Users to Excel 1 November 30th 07 08:06 PM
HELP on "left","right","find","len","substitute" functions serene83 Excel Discussion (Misc queries) 5 June 27th 06 02:23 AM
Find a "date" in a column of dates in Excel 2000 JR Hester Excel Worksheet Functions 3 November 1st 05 09:17 PM
Insert "-" in text "1234567890" to have a output like this"123-456-7890" Alwyn Excel Discussion (Misc queries) 3 October 25th 05 11:36 PM


All times are GMT +1. The time now is 03:10 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"