Home |
Search |
Today's Posts |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I found the problem it was a type O on my part.
Thank You, Mr. Phillips "Incidental" wrote: Hi there I just refreshed the page and I see that Bob has posted a very good reply to your problem so I am posting this as another option for how to get round this though I would say to go with Bobs code as it is much more efficient than the code below which uses a findnext method steve Option Explicit Dim LastRow As Integer Dim i As Integer Dim MyRng As Range Dim Fcell As Range Dim FcellAdd As String Dim FindRef As String Private Sub CommandButton1_Click() LastRow = [a65535].End(xlUp).Row Set MyRng = Range("A1:A" & LastRow) FindRef = "apple" i = 1 Do While i <= 3 Set Fcell = MyRng.Find(FindRef, Lookat:=xlWhole) If Not Fcell Is Nothing Then FcellAdd = Fcell.Address Do Set Fcell = MyRng.FindNext(Fcell) Loop While Not Fcell Is Nothing And Fcell.Address < FcellAdd ComboBox1.AddItem Fcell.Value End If i = i + 1 If i = 2 Then FindRef = "pear" Else FindRef = "grape" End If Loop End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro needed to search 2 columns | Excel Programming | |||
merge columns into single report - macro needed | Excel Discussion (Misc queries) | |||
Looping macro needed to find intersections of rows and columns | Excel Programming | |||
Help needed with macro: Writing contents of two cells to two new columns | Excel Programming | |||
Macro or Formula needed to search data in cells | Excel Programming |