Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I've got a simple problem (I think) I would like to search within a selection using the find method. Then transfer the found cells to a listbox. The problem is that the code I'm using loops a "few times to many". Does anyone know what's wrong with it? Here's the code Private Sub CommandButton2_Click() Dim sh As Worksheet Set sh = ThisWorkbook.Worksheets("sheet1") sh.UsedRange.Activate cntend = LastRow(sh) Selection.Find(What:="cash", After:=ActiveCell, LookIn:=xlValues, Lookat:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=True, SearchFormat:=False).Activate ActiveCell.Select counter = 1 Do While counter < cntend Cells.FindNext(After:=ActiveCell).Activate ListBox1.AddItem ActiveCell.Value counter = counter + 1 Loop End Sub Help Appreciated, Farmer |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
problem filling in blank cells with data above - | Excel Discussion (Misc queries) | |||
Where do I find a template for filling out 1099-MISC forms? | Excel Discussion (Misc queries) | |||
Filling down problem in VB | Excel Programming | |||
filling a two column listbox from a two column recordset | Excel Programming | |||
Filling a listbox depending on font index | Excel Programming |