#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 156
Default FindFirst


Is there a quick way to find the first instance of something in a cell
- rather than move through line by line?

Thanks - Kirk
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default FindFirst

Kirk,
Check out the Find method in the Help.

NickHK

"kirkm" wrote in message
...

Is there a quick way to find the first instance of something in a cell
- rather than move through line by line?

Thanks - Kirk



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 156
Default FindFirst

On Tue, 12 Sep 2006 14:43:36 +0800, "NickHK"
wrote:

Kirk,
Check out the Find method in the Help.

NickHK


Yeah.... I tried that. I seem to have just the Office Assistant which
told me to click on Find.... not much use as I want to use VB.
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default FindFirst

You need the help in the VBA IDE, not Excel help.

Press Alt+F11, then F1.
VBA Help is an option during Office installation, so if it is not available
you will need add it.

NickHK

"kirkm" wrote in message
...
On Tue, 12 Sep 2006 14:43:36 +0800, "NickHK"
wrote:

Kirk,
Check out the Find method in the Help.

NickHK


Yeah.... I tried that. I seem to have just the Office Assistant which
told me to click on Find.... not much use as I want to use VB.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default FindFirst

Straight from help

With Worksheets(1).Range("a1:a500")
Set c = .Find(2, lookin:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
c.Value = 5
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address < firstAddress
End If
End With

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"kirkm" wrote in message
...

Is there a quick way to find the first instance of something in a cell
- rather than move through line by line?

Thanks - Kirk





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 156
Default FindFirst

On Tue, 12 Sep 2006 08:54:51 +0100, "Bob Phillips"
wrote:

Straight from help

With Worksheets(1).Range("a1:a500")
Set c = .Find(2, lookin:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
c.Value = 5
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address < firstAddress
End If
End With


Thanks Bob... amazing stuff! Means absolutely nothing to me!
My 'Help' seems to be missing..... I'll keep Googling :)

Cheers - Kirk
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default FindFirst

It is quite straightforward

A1:A500 is the range being looked at

2 is the value being looked for

If Not c Is Nothing means that something was found.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"kirkm" wrote in message
...
On Tue, 12 Sep 2006 08:54:51 +0100, "Bob Phillips"
wrote:

Straight from help

With Worksheets(1).Range("a1:a500")
Set c = .Find(2, lookin:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
c.Value = 5
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address < firstAddress
End If
End With


Thanks Bob... amazing stuff! Means absolutely nothing to me!
My 'Help' seems to be missing..... I'll keep Googling :)

Cheers - Kirk



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
Recordset.FindFirst argument not working... [email protected] Excel Worksheet Functions 0 March 20th 07 03:18 PM
FindFirst, FindLast and select Noemi Excel Discussion (Misc queries) 2 February 2nd 06 03:46 AM


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