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

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Try

Code:
Input_EstNotes_Col = InputSheet.Rows(myInputHeaderRow).Find(What:="Comments", LookIn:=xlValues, LookAt:=xlWhole).Column
 
Upvote 0
Done, I actually had done something really stupid but your response mad eme look at the really stupid thing I did...sigh

Thanks.
 
Upvote 0

Forum statistics

Threads
1,224,583
Messages
6,179,673
Members
452,937
Latest member
Bhg1984

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
Back
Top