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

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
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,214,936
Messages
6,122,340
Members
449,079
Latest member
rocketslinger

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