Column number
How can I retrieve the column number of a cell in a specific row.
ie i want to get the column number of a cell in row 3 that holds the value "successful" for instance Thanks Faby |
Column number
Faby wrote:
How can I retrieve the column number of a cell in a specific row. ie i want to get the column number of a cell in row 3 that holds the value "successful" for instance Thanks Faby If you are searching the row for a specific value then use the MATCH worksheet function using the row itself as the lokup array. The MATCH function will return the offset at which the value was found. |
Column number
Alleluia!!Thank you Norman, it works!
Thanks a lot Faby |
Column number
in simplest form
Sub findcol() mc = Rows(2).Find("a").Column MsgBox mc End Sub -- Don Guillett SalesAid Software "Faby" wrote in message ups.com... How can I retrieve the column number of a cell in a specific row. ie i want to get the column number of a cell in row 3 that holds the value "successful" for instance Thanks Faby |
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 |
Column number
Hi all,
Thanks a lot for all your answers. I like your short version, Don.Thanks Faby |
All times are GMT +1. The time now is 05:17 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com