Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Ella Campbell   on Sep 17 In MS Office Category.

  
Question Answered By: Tarrant Thompson   on Sep 17

Function WhichColumn(myStr)
Application.Volatile 'can remove if not using
'this function as a worksheet function
Set dd = Cells.Find(What:=myStr, After:=Cells(Cells.Rows.Count, _
Cells.Columns.Count), LookIn:=xlValues, LookAt:=xlPart, _
SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False)
If Not dd Is Nothing Then WhichColumn = _
dd.Column Else WhichColumn = "Not found"
End Function

Use in a worksheet formula thus:

=WhichColumn("First assign time")

and in vba  code thus:

x = WhichColumn("First assign time")

or

y = "First Assign time"
x= WhichColumn(y)

Share: 

 

This Question has 7 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on how to include double quote in string Or get search suggestion and latest updates.


Tagged: