Hello,
I am trying to lookup a text string in a row and return the column number of that string. Here is my code:
Sub Findd()
'Finds column number of a selected product
Dim plan As Variant
Dim myColumn As Integer
With Sheets("Dollar Base").Range("4:4")
Set plan = Rows(4).Find(What:="Basic", After:=.Cells(1, 1), LookIn:=xlValues, LookAt:= _
xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, MatchCase:=False _
, SearchFormat:=False)
Sheets("New Inputs").Range("A7").Value = plan
plan.Select
myColumn = ActiveCell.Column
End With
End Sub
Frustratingly, it sometimes works, but other times does not. I am assuming my code is not sound. Any help is greatly appreciated. Thanks.
Steve
Bookmarks