LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default find next finds too much.

Greeting,
I am developing something for a user.
i have 2 cascading combo that corrosponds with data on the
sheet. the user wants the combo to change the color on the
data on the sheet when she selects something from the
combo box.
I have achieved this. however... the find next part of the
code goes through the range what seems like 50 times be
for it stops causing a delay of about 3-5 seconds.
meanwhile the now colored cells just flicker as the code
loops through the range over and over. I have tried
several thing but nothing works. i'm stumped. How do i
have the code go through the range only once.
heres the code i have so far....
it is the for next loop that is doing it.
Private Sub ComboBox2_Change()
Dim c As String
Dim rng As Range
Dim cell As Range
c = Me.ComboBox2.Value
Set rng = Range("A1:R33")
rng.Interior.ColorIndex = xlNone
If c = "" Then
rng.Interior.ColorIndex = xlNone
Else
Cells.Find(What:=c, _
After:=Range("A1"), _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False).Activate
ActiveCell.Interior.ColorIndex = 42
If ActiveCell.Interior.ColorIndex = 42 Then
For Each cell In rng
Cells.FindNext(After:=ActiveCell).Activate
ActiveCell.Interior.ColorIndex = 42
Next
End If
End If
End Sub

 
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
lookup only finds #n/a's Janis Excel Discussion (Misc queries) 4 July 26th 07 11:02 PM
Which @function finds the mean of a number? Coffeecoco930 Excel Worksheet Functions 5 December 9th 04 03:11 AM
Only finds first Occurrence Steved[_3_] Excel Programming 2 September 10th 04 01:33 AM
finds and concatenate vikram Excel Programming 3 May 20th 04 02:02 PM
Find finds nothing, and errors Chris M.[_3_] Excel Programming 1 August 25th 03 06:31 PM


All times are GMT +1. The time now is 10:08 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"