FIND code determining wrong value

rdw72777

Well-known Member
Joined
Apr 5, 2005
Messages
723
I have the code below that I thought was working but now realize its not.

Code:
Input_EstNotes_Col = InputSheet.Rows(myInputHeaderRow).Find(What:="Comments", SearchDirection:=xlPrevious, SearchOrder:=xlByColumns).Column

Becasue I have a column called "Varaince Comments", my find code above finds the first instance of "Comments anywhere in a cell, rather than matching the entire contents of cell. I changed the code to add in the "LookAt:=xlWhole" syntax, but now I just get an error when it hits that line of code. How can i write this line of code to find where teh entire contencts of the cell are the word "Comments"?

Code:
Input_EstNotes_Col = InputSheet.Rows(myInputHeaderRow).Find(What:="Comments", SearchDirection:=xlPrevious, LookAt:=xlWhole, SearchOrder:=xlByColumns).Column
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
Try

Code:
Input_EstNotes_Col = InputSheet.Rows(myInputHeaderRow).Find(What:="Comments", LookIn:=xlValues, LookAt:=xlWhole).Column
 

rdw72777

Well-known Member
Joined
Apr 5, 2005
Messages
723
Done, I actually had done something really stupid but your response mad eme look at the really stupid thing I did...sigh

Thanks.
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,302
Messages
5,836,504
Members
430,436
Latest member
fefenouil

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top