#1   Report Post  
Posted to microsoft.public.excel.programming
nk nk is offline
external usenet poster
 
Posts: 5
Default Find method

Is this posible to get a row number(when the value 2 was find) with a
Find metod in code:
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'
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Find method

Yes, it will be c.Row

--

HTH

RP
(remove nothere from the email address if mailing direct)


"nk" wrote in message
m...
Is this posible to get a row number(when the value 2 was find) with a
Find metod in code:
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'



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default Find method

If you only need to find the first instance then this will work.

Sub find2()
MsgBox Columns(1).Find(2, lookat:=xlWhole).Row
End Sub


--
Don Guillett
SalesAid Software

"nk" wrote in message
m...
Is this posible to get a row number(when the value 2 was find) with a
Find metod in code:
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'



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
with -.find end with method Peter[_21_] Excel Programming 1 December 26th 04 11:49 AM
Find method benb Excel Programming 0 September 22nd 04 10:17 PM
Find method Ron de Bruin Excel Programming 0 September 22nd 04 09:25 PM
Find method example Shinichi Excel Programming 3 August 22nd 03 10:39 PM
The Find Method Dick Kusleika Excel Programming 3 July 16th 03 07:59 PM


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