Thread: Column number
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default Column number

Hi Faby,

A slightly better version would be:

'=============
Public Sub Tester()
Dim rng As Range
Dim col As Long
Const rw As Long = 8
Const sFindText As String = "successful"

Set rng = Rows(rw).Find(What:=sFindText, _
After:=Rows(rw).Cells(1), _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByColumns, _
SearchDirection:=xlNext)
If Not rng Is Nothing Then
col = rng.Column
MsgBox col
Else
MsgBox """" & sFindText & """ not found in row " & rw
End If

End Sub
'<<=============


---
Regards,
Norman



"Faby" wrote in message
ups.com...
Alleluia!!Thank you Norman, it works!
Thanks a lot
Faby