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
 

Some videos you may like

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.

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.
 

Watch MrExcel Video

Forum statistics

Threads
1,109,360
Messages
5,528,233
Members
409,809
Latest member
VICKRAM

This Week's Hot Topics

  • Change military grades into rank
    Afternoon all Need help with formula that will change military rank (i.e. 1, 2, 3 into Amn, A1C, SrA). Running IF formula that does not work...
  • VBA COUNTIF SOLUTION
    Hi The following are the errors spread across the several columns from E to Q ie. 13 columns across several sheets with more than 500 rows per...
  • INSERT ROW WITH SPECIFIS TEXT IN A COLUMN
    Hi All! How can identify that that the row to be inserted has to be inserted before 1st row with specific text in column F. If I record the...
  • Auto-Create a monthly Sign in sheet for preschool students
    The image below is what each page looks like. Above is space for the "Child Name" "Month" "Class" School days are obviously Monday-Friday but...
  • VBA vlookup multiple results
    Hi folks, Hopefully someone out there can help. I have a list to vlookup which works (ish). the lookup only picks up the first instance of the...
  • Extract values for earliest/latest times
    I am trying to put together a formula to get the earliest start time, the latest end time from column A for each person in Column B-F without the...
Top