Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 116
Default Search for Values part2

Somehow my question got changed?

I like to thank the Big Guns (developers) for their answer but May I
offer a more humble solution. I doesn't work properly, so if someone
could look at it I would appreciate it.
'--------------------------------------------------------------------
Sub Macro1Find()

'Clear the current range
Range("B1:F6").Select
Selection.Interior.ColorIndex = xlNone

For i = 1 To 10 ' Look at values in A1 to A10
Lookupvalue = Cells(i, 1).Value

With Range("B2:F6")
Set C = .Find(Lookupvalue, LookIn:=xlValues)
If Not C Is Nothing Then
'(if match then highlight the cell in range}
Range(C.Address).Select
With Selection.Interior
.ColorIndex = 39
.Pattern = xlSolid
End With
End If
End With
Next

End Sub

'------------------------------------------------------------------------
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 735
Default Search for Values part2

It is better not to start a new thread, however the following code works for
me. Slight modification to your version.

Sub Macro1Find()
Dim lookupvalue As String
Dim c As Range
Dim i As Integer

'Clear the current range
Range("B1:F6").Interior.ColorIndex = xlNone

For i = 1 To 10 ' Look at values in A1 to A10
lookupvalue = Trim(Cells(i, 1).Value)

With Range("B2:F6")
Set c = .Find(lookupvalue, LookIn:=xlValues)
If Not c Is Nothing Then
'(if match then highlight the cell in range}
With Range(c.Address).Interior
.ColorIndex = 39
.Pattern = xlSolid
End With
End If
End With
Next

End Sub

--

Regards,
Nigel




"smandula" wrote in message
...
Somehow my question got changed?

I like to thank the Big Guns (developers) for their answer but May I
offer a more humble solution. I doesn't work properly, so if someone
could look at it I would appreciate it.
'--------------------------------------------------------------------
Sub Macro1Find()

'Clear the current range
Range("B1:F6").Select
Selection.Interior.ColorIndex = xlNone

For i = 1 To 10 ' Look at values in A1 to A10
Lookupvalue = Cells(i, 1).Value

With Range("B2:F6")
Set C = .Find(Lookupvalue, LookIn:=xlValues)
If Not C Is Nothing Then
'(if match then highlight the cell in range}
Range(C.Address).Select
With Selection.Interior
.ColorIndex = 39
.Pattern = xlSolid
End With
End If
End With
Next

End Sub

'------------------------------------------------------------------------


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 116
Default Search for Values part2

Thanks Nigel,

I don't know what happen! Your solution works great.

When I tried my original solution; it also worked.

Thanks, your method is more elegant.
Thanks again
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
Sort problem - part2 hshayh0rn Excel Programming 1 January 5th 06 04:21 AM
Search multiple values to return single values JANA Excel Worksheet Functions 8 October 27th 05 04:26 PM
Search/Filter to find values in another range based on two cell values Andy Excel Programming 2 April 29th 04 04:08 PM
find largest data (part2) hard work.. Mark[_28_] Excel Programming 1 October 16th 03 12:52 PM
How do I search thr'o column and put unique values in differnt sheet and sum corresponding values in test test Excel Programming 3 September 9th 03 08:53 PM


All times are GMT +1. The time now is 07:01 PM.

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"