Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default Find a value in a column

I'm trying to run the following Find command in VBA:

sERRow = oWkSht.Columns("C").Find(What:="eligible for rebate",
After:=ActiveCell, LookIn:= _
xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=
_
xlNext, MatchCase:=False, SearchFormat:=False).Row

Once I find the text, I need to parse out the contents of the cell, but
currently the text is not being found. I know the text is there and I have
tried recording a macro to see what steps Excel would use. I also know that
I lose the Intelli-Sense when I add the .Row onto it. If there's a better
way to do it, please let me know.

Thanx!

--
TFWBWY...A


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Find a value in a column

Bryan,

It works fine for me. Are you sure that the item in column C doesn't have
trailing spaces in it, which would cause a mis-match.

--
HTH

Bob Phillips

"Bryan Dickerson" wrote in message
...
I'm trying to run the following Find command in VBA:

sERRow = oWkSht.Columns("C").Find(What:="eligible for rebate",
After:=ActiveCell, LookIn:= _
xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows,

SearchDirection:=
_
xlNext, MatchCase:=False, SearchFormat:=False).Row

Once I find the text, I need to parse out the contents of the cell, but
currently the text is not being found. I know the text is there and I

have
tried recording a macro to see what steps Excel would use. I also know

that
I lose the Intelli-Sense when I add the .Row onto it. If there's a better
way to do it, please let me know.

Thanx!

--
TFWBWY...A




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Find a value in a column

xlpart should take care of the trailing spaces--but not embedded spaces--or
other typos!

Bob Phillips wrote:

Bryan,

It works fine for me. Are you sure that the item in column C doesn't have
trailing spaces in it, which would cause a mis-match.

--
HTH

Bob Phillips

"Bryan Dickerson" wrote in message
...
I'm trying to run the following Find command in VBA:

sERRow = oWkSht.Columns("C").Find(What:="eligible for rebate",
After:=ActiveCell, LookIn:= _
xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows,

SearchDirection:=
_
xlNext, MatchCase:=False, SearchFormat:=False).Row

Once I find the text, I need to parse out the contents of the cell, but
currently the text is not being found. I know the text is there and I

have
tried recording a macro to see what steps Excel would use. I also know

that
I lose the Intelli-Sense when I add the .Row onto it. If there's a better
way to do it, please let me know.

Thanx!

--
TFWBWY...A



--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default Find a value in a column

"eligible for rebate" is actually the start of the phrase in the contents of
the cell--the full contents might be something like "Eligible for rebate
$600 if order by 12/01/05". I made sure that the MatchCase is false so that
if they don't capitalize it, then it should still be found. I tried
searching for just "for rebate" and still nothing. I keep thinking it's the
".Row" property on the end, but if it works for you guys, then maybe it is
acceptable. What other things would you guys try to see what is wrong or to
perhaps do it another way?

"Dave Peterson" wrote in message
...
xlpart should take care of the trailing spaces--but not embedded
spaces--or
other typos!

Bob Phillips wrote:

Bryan,

It works fine for me. Are you sure that the item in column C doesn't have
trailing spaces in it, which would cause a mis-match.

--
HTH

Bob Phillips

"Bryan Dickerson" wrote in message
...
I'm trying to run the following Find command in VBA:

sERRow = oWkSht.Columns("C").Find(What:="eligible for rebate",
After:=ActiveCell, LookIn:= _
xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows,

SearchDirection:=
_
xlNext, MatchCase:=False, SearchFormat:=False).Row

Once I find the text, I need to parse out the contents of the cell, but
currently the text is not being found. I know the text is there and I

have
tried recording a macro to see what steps Excel would use. I also know

that
I lose the Intelli-Sense when I add the .Row onto it. If there's a
better
way to do it, please let me know.

Thanx!

--
TFWBWY...A



--

Dave Peterson



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default Find a value in a column

As much of a revelation as it is, I found something that works, but I'm not
too secure with it and that is shortening the string to just "eligible".
I'm not too secure with it because in the example I was working with just a
few rows down there was another cell that also had "eligible" in it, so I
would feel better if I could get "eligible for rebate" to work, but I will
go with this for now. I would still appreciate any comments that anyone
might have.

"Bryan Dickerson" wrote in message
...
"eligible for rebate" is actually the start of the phrase in the contents
of the cell--the full contents might be something like "Eligible for
rebate $600 if order by 12/01/05". I made sure that the MatchCase is
false so that if they don't capitalize it, then it should still be found.
I tried searching for just "for rebate" and still nothing. I keep
thinking it's the ".Row" property on the end, but if it works for you
guys, then maybe it is acceptable. What other things would you guys try
to see what is wrong or to perhaps do it another way?

"Dave Peterson" wrote in message
...
xlpart should take care of the trailing spaces--but not embedded
spaces--or
other typos!

Bob Phillips wrote:

Bryan,

It works fine for me. Are you sure that the item in column C doesn't
have
trailing spaces in it, which would cause a mis-match.

--
HTH

Bob Phillips

"Bryan Dickerson" wrote in message
...
I'm trying to run the following Find command in VBA:

sERRow = oWkSht.Columns("C").Find(What:="eligible for rebate",
After:=ActiveCell, LookIn:= _
xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows,
SearchDirection:=
_
xlNext, MatchCase:=False, SearchFormat:=False).Row

Once I find the text, I need to parse out the contents of the cell,
but
currently the text is not being found. I know the text is there and I
have
tried recording a macro to see what steps Excel would use. I also
know
that
I lose the Intelli-Sense when I add the .Row onto it. If there's a
better
way to do it, please let me know.

Thanx!

--
TFWBWY...A



--

Dave Peterson







  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Find a value in a column

Is that "eligible for rebate" actually in the cell?

It's not part of some custom formatting, is it?

Can you find one of those cells and put this in an adjacent (empty cell):

=countif(c99,"*eligible for rebate*")
(change c99 to the cell's address)

What do you get?

I'm still guessing it's a typo!



Bryan Dickerson wrote:

As much of a revelation as it is, I found something that works, but I'm not
too secure with it and that is shortening the string to just "eligible".
I'm not too secure with it because in the example I was working with just a
few rows down there was another cell that also had "eligible" in it, so I
would feel better if I could get "eligible for rebate" to work, but I will
go with this for now. I would still appreciate any comments that anyone
might have.

"Bryan Dickerson" wrote in message
...
"eligible for rebate" is actually the start of the phrase in the contents
of the cell--the full contents might be something like "Eligible for
rebate $600 if order by 12/01/05". I made sure that the MatchCase is
false so that if they don't capitalize it, then it should still be found.
I tried searching for just "for rebate" and still nothing. I keep
thinking it's the ".Row" property on the end, but if it works for you
guys, then maybe it is acceptable. What other things would you guys try
to see what is wrong or to perhaps do it another way?

"Dave Peterson" wrote in message
...
xlpart should take care of the trailing spaces--but not embedded
spaces--or
other typos!

Bob Phillips wrote:

Bryan,

It works fine for me. Are you sure that the item in column C doesn't
have
trailing spaces in it, which would cause a mis-match.

--
HTH

Bob Phillips

"Bryan Dickerson" wrote in message
...
I'm trying to run the following Find command in VBA:

sERRow = oWkSht.Columns("C").Find(What:="eligible for rebate",
After:=ActiveCell, LookIn:= _
xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows,
SearchDirection:=
_
xlNext, MatchCase:=False, SearchFormat:=False).Row

Once I find the text, I need to parse out the contents of the cell,
but
currently the text is not being found. I know the text is there and I
have
tried recording a macro to see what steps Excel would use. I also
know
that
I lose the Intelli-Sense when I add the .Row onto it. If there's a
better
way to do it, please let me know.

Thanx!

--
TFWBWY...A



--

Dave Peterson




--

Dave Peterson
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default Find a value in a column

I get a right-justified "1" (without the quotes, of course). What does that
mean?

"Dave Peterson" wrote in message
...
Is that "eligible for rebate" actually in the cell?

It's not part of some custom formatting, is it?

Can you find one of those cells and put this in an adjacent (empty cell):

=countif(c99,"*eligible for rebate*")
(change c99 to the cell's address)

What do you get?

I'm still guessing it's a typo!



Bryan Dickerson wrote:

As much of a revelation as it is, I found something that works, but I'm
not
too secure with it and that is shortening the string to just "eligible".
I'm not too secure with it because in the example I was working with just
a
few rows down there was another cell that also had "eligible" in it, so I
would feel better if I could get "eligible for rebate" to work, but I
will
go with this for now. I would still appreciate any comments that anyone
might have.

"Bryan Dickerson" wrote in message
...
"eligible for rebate" is actually the start of the phrase in the
contents
of the cell--the full contents might be something like "Eligible for
rebate $600 if order by 12/01/05". I made sure that the MatchCase is
false so that if they don't capitalize it, then it should still be
found.
I tried searching for just "for rebate" and still nothing. I keep
thinking it's the ".Row" property on the end, but if it works for you
guys, then maybe it is acceptable. What other things would you guys
try
to see what is wrong or to perhaps do it another way?

"Dave Peterson" wrote in message
...
xlpart should take care of the trailing spaces--but not embedded
spaces--or
other typos!

Bob Phillips wrote:

Bryan,

It works fine for me. Are you sure that the item in column C doesn't
have
trailing spaces in it, which would cause a mis-match.

--
HTH

Bob Phillips

"Bryan Dickerson" wrote in message
...
I'm trying to run the following Find command in VBA:

sERRow = oWkSht.Columns("C").Find(What:="eligible for rebate",
After:=ActiveCell, LookIn:= _
xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows,
SearchDirection:=
_
xlNext, MatchCase:=False, SearchFormat:=False).Row

Once I find the text, I need to parse out the contents of the cell,
but
currently the text is not being found. I know the text is there
and I
have
tried recording a macro to see what steps Excel would use. I also
know
that
I lose the Intelli-Sense when I add the .Row onto it. If there's a
better
way to do it, please let me know.

Thanx!

--
TFWBWY...A



--

Dave Peterson



--

Dave Peterson



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Find a value in a column

That means that "eligible for rebate" is in that cell.

And all my theories about typos goes flying out the window!.

Maybe it's the way you wrote the code.

sERRow = oWkSht.Columns("C").Find(What:="eligible for rebate", _
After:=ActiveCell, LookIn:= _
xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:= _
xlNext, MatchCase:=False, SearchFormat:=False).Row

Could cause errors if oWksht isn't the activesheet or the activecell isn't in
column C.

I think I'd use something like this:

Option Explicit
Sub testme()

Dim sERRow As Long
Dim FoundCell As Range
Dim oWkSht As Worksheet
Dim myStr As String

myStr = "eligible for rebate"

Set oWkSht = Worksheets("Sheet1")

With oWkSht.Range("C:C")
Set FoundCell = .Cells.Find(What:=myStr, _
After:=.Cells(.Cells.Count), LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False, _
SearchFormat:=False)
End With

If FoundCell Is Nothing Then
MsgBox "Oh, oh. What happens here?"
Exit Sub '???
End If

sERRow = FoundCell.Row

MsgBox sERRow

End Sub

Bryan Dickerson wrote:

I get a right-justified "1" (without the quotes, of course). What does that
mean?

"Dave Peterson" wrote in message
...
Is that "eligible for rebate" actually in the cell?

It's not part of some custom formatting, is it?

Can you find one of those cells and put this in an adjacent (empty cell):

=countif(c99,"*eligible for rebate*")
(change c99 to the cell's address)

What do you get?

I'm still guessing it's a typo!



Bryan Dickerson wrote:

As much of a revelation as it is, I found something that works, but I'm
not
too secure with it and that is shortening the string to just "eligible".
I'm not too secure with it because in the example I was working with just
a
few rows down there was another cell that also had "eligible" in it, so I
would feel better if I could get "eligible for rebate" to work, but I
will
go with this for now. I would still appreciate any comments that anyone
might have.

"Bryan Dickerson" wrote in message
...
"eligible for rebate" is actually the start of the phrase in the
contents
of the cell--the full contents might be something like "Eligible for
rebate $600 if order by 12/01/05". I made sure that the MatchCase is
false so that if they don't capitalize it, then it should still be
found.
I tried searching for just "for rebate" and still nothing. I keep
thinking it's the ".Row" property on the end, but if it works for you
guys, then maybe it is acceptable. What other things would you guys
try
to see what is wrong or to perhaps do it another way?

"Dave Peterson" wrote in message
...
xlpart should take care of the trailing spaces--but not embedded
spaces--or
other typos!

Bob Phillips wrote:

Bryan,

It works fine for me. Are you sure that the item in column C doesn't
have
trailing spaces in it, which would cause a mis-match.

--
HTH

Bob Phillips

"Bryan Dickerson" wrote in message
...
I'm trying to run the following Find command in VBA:

sERRow = oWkSht.Columns("C").Find(What:="eligible for rebate",
After:=ActiveCell, LookIn:= _
xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows,
SearchDirection:=
_
xlNext, MatchCase:=False, SearchFormat:=False).Row

Once I find the text, I need to parse out the contents of the cell,
but
currently the text is not being found. I know the text is there
and I
have
tried recording a macro to see what steps Excel would use. I also
know
that
I lose the Intelli-Sense when I add the .Row onto it. If there's a
better
way to do it, please let me know.

Thanx!

--
TFWBWY...A



--

Dave Peterson



--

Dave Peterson


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
FInd common data in one column then add number in adjacent column JT Excel Worksheet Functions 3 December 18th 09 10:20 PM
find last row value in column when using MATCH to find column Bouce Excel Worksheet Functions 6 February 6th 08 10:16 PM
Find something in column a then find if column B matches criteria Darrell_Sarrasin via OfficeKB.com Excel Discussion (Misc queries) 8 November 28th 07 09:40 PM
Find First Non blank cell than find column header and return that value Silver Rose Excel Worksheet Functions 10 April 30th 07 05:56 PM
How to find the most recent date in a column based on other column Veretax Excel Worksheet Functions 7 October 18th 06 05:01 PM


All times are GMT +1. The time now is 08:04 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"