#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Find

Hi all,

I got the error message : "Unable to find property of Range class" fro
Excel VBA and I have ben looking for the bug(s) a long time, so anyon
would kindly give me a hand?

Problem tackled:
1) matchRow = Worksheets("Raw Data").UsedRange.Find(What:=poNo
LookIn:=xlFormula, LookAt:=xlWhole).Row

p.s I want to search the corresponding row with the wanted number i
another sheet.

Public Sub Mark2004Po()
Dim i As Integer
Dim poNo As String
Dim matchRow As Range

For i = 2 T
Worksheets("Settings").UsedRange.Columns(1).Rows.C ount
poNo = Worksheets("Settings").Cells(i, 1).Value
If Not IsEmpty(poNo) Then
Do
matchRow = Worksheets("Ra
Data").UsedRange.Find(What:=poNo, LookIn:=xlFormula
LookAt:=xlWhole).Row
If Not (matchRow Is Nothing) Then
matchRow.Interior.ColorIndex = 2
End If
Loop Until matchRow Is Nothing
End If
Next i
End Sub

Thanks in advance

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default Find

Perhaps because you are declaring the variable matchRow as a Range object
rather than an Integer or a Long, and then assigining a row number to it.

If you want it to be a range, try replacing .Row with .EntireRow in your
assignment statement. You will also need to use the Set keyword to assign a
range object to the variable:

Set matchRow = Worksheets("Raw Data").UsedRange _
..Find(What:=poNo, LookIn:=xlFormula, _
LookAt:=xlWhole).EntireRow

--

Vasant

"kaon " wrote in message
...
Hi all,

I got the error message : "Unable to find property of Range class" from
Excel VBA and I have ben looking for the bug(s) a long time, so anyone
would kindly give me a hand?

Problem tackled:
1) matchRow = Worksheets("Raw Data").UsedRange.Find(What:=poNo,
LookIn:=xlFormula, LookAt:=xlWhole).Row

p.s I want to search the corresponding row with the wanted number in
another sheet.

Public Sub Mark2004Po()
Dim i As Integer
Dim poNo As String
Dim matchRow As Range

For i = 2 To
Worksheets("Settings").UsedRange.Columns(1).Rows.C ount
poNo = Worksheets("Settings").Cells(i, 1).Value
If Not IsEmpty(poNo) Then
Do
matchRow = Worksheets("Raw
Data").UsedRange.Find(What:=poNo, LookIn:=xlFormula,
LookAt:=xlWhole).Row
If Not (matchRow Is Nothing) Then
matchRow.Interior.ColorIndex = 2
End If
Loop Until matchRow Is Nothing
End If
Next i
End Sub

Thanks in advance.


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Find

Public Sub Mark2004Po()
Dim i As Integer
Dim poNo As String
Dim matchRow As Range
Dim fAddr As String

For i = 2 To _
Worksheets("Settings").UsedRange _
.Columns(1).Rows.Count
poNo = Worksheets("Settings").Cells(i, 1).Value
If Not IsEmpty(poNo) Then
With Worksheets("Raw Data"). _
UsedRange
Set rng = .Find(What:=poNo, _
LookIn:=xlFormula, _
LookAt:=xlWhole)
If Not rng Is Nothing Then
fAddr = rng.Address
Do
rngEntireRow.Interior.ColorIndex = 2
Set rng = .FindNext(rng)
Loop While rng.Address < fAddr
End If
End With
End If
Next i
End Sub

--
Regards,
Tom Ogilvy


"kaon " wrote in message
...
Hi all,

I got the error message : "Unable to find property of Range class" from
Excel VBA and I have ben looking for the bug(s) a long time, so anyone
would kindly give me a hand?

Problem tackled:
1) matchRow = Worksheets("Raw Data").UsedRange.Find(What:=poNo,
LookIn:=xlFormula, LookAt:=xlWhole).Row

p.s I want to search the corresponding row with the wanted number in
another sheet.

Public Sub Mark2004Po()
Dim i As Integer
Dim poNo As String
Dim matchRow As Range

For i = 2 To
Worksheets("Settings").UsedRange.Columns(1).Rows.C ount
poNo = Worksheets("Settings").Cells(i, 1).Value
If Not IsEmpty(poNo) Then
Do
matchRow = Worksheets("Raw
Data").UsedRange.Find(What:=poNo, LookIn:=xlFormula,
LookAt:=xlWhole).Row
If Not (matchRow Is Nothing) Then
matchRow.Interior.ColorIndex = 2
End If
Loop Until matchRow Is Nothing
End If
Next i
End Sub

Thanks in advance.


---
Message posted from http://www.ExcelForum.com/



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Find

Public Sub Mark2004Po_2()
Dim i As Integer
Dim poNo As String
Dim fAddr As String
Dim rng As Range

For i = 2 T
Worksheets("Settings").UsedRange.Columns(1).Rows.C ount
poNo = Worksheets("Settings").Cells(i, 1).Value
If Not IsEmpty(poNo) Then
With Worksheets("Raw Data").UsedRange
***Set rng = .Find(What:=poNo, LookIn:=xlFormula
LookAt:=xlWhole) ***
If Not rng Is Nothing Then
fAddr = rng.Address
Do
rng.EntireRow.Interior.ColorIndex = 2
Set rng = .FindNext(rng)
Loop While rng.Address < fAddr
End If
End With
End If
Next i
End Sub


Thanks both of you but I have tackled another problem on the lin
marked with *** and message shows on the screen: "Unable to get th
Find property of the Range Class.

--
Message posted from http://www.ExcelForum.com

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Find

change

Lookin:=xlFormula

to

Lookin:=xlFormulas

After that, it
worked fine for me.

--
Regards,
Tom Ogilvy

"kaon " wrote in message
...
Public Sub Mark2004Po_2()
Dim i As Integer
Dim poNo As String
Dim fAddr As String
Dim rng As Range

For i = 2 To
Worksheets("Settings").UsedRange.Columns(1).Rows.C ount
poNo = Worksheets("Settings").Cells(i, 1).Value
If Not IsEmpty(poNo) Then
With Worksheets("Raw Data").UsedRange
***Set rng = .Find(What:=poNo, LookIn:=xlFormula,
LookAt:=xlWhole) ***
If Not rng Is Nothing Then
fAddr = rng.Address
Do
rng.EntireRow.Interior.ColorIndex = 2
Set rng = .FindNext(rng)
Loop While rng.Address < fAddr
End If
End With
End If
Next i
End Sub


Thanks both of you but I have tackled another problem on the line
marked with *** and message shows on the screen: "Unable to get the
Find property of the Range Class."


---
Message posted from http://www.ExcelForum.com/



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 First Non blank cell than find column header and return that value Silver Rose Excel Worksheet Functions 10 April 30th 07 05:56 PM
where to put results of find operation in find and replace functio DEP Excel Worksheet Functions 5 November 15th 06 07:52 PM
Despite data existing in Excel 2002 spreadsheet Find doesn't find AnnieB Excel Discussion (Misc queries) 1 June 16th 06 02:15 AM
How do I find a file/spreadsheet that Excel says is Already open but I can't find it? nwtrader8 Excel Discussion (Misc queries) 5 June 21st 05 02:16 PM
backwards find function to find character in a string of text Ashleigh K. Excel Programming 1 January 14th 04 04:36 PM


All times are GMT +1. The time now is 07:50 AM.

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

About Us

"It's about Microsoft Excel"