ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,224
- Office Version
- 2007
- Platform
- Windows
Evening,
Im using the code below but it will only work if xlWhole is used.
Im needing it to work using xlPart
Do you see wjhy this should happen
Im using the code below but it will only work if xlWhole is used.
Im needing it to work using xlPart
Do you see wjhy this should happen
Rich (BB code):
Private Sub CommandButton1_Click()
Dim Ws1 As Worksheet, Ws2 As Worksheet
Dim Fnd As Range
Dim i As Long, Qty As Long, Nrow As Long
Dim Str As String
Set Ws1 = Sheets("DETAILS")
Set Ws2 = Sheets("HELPERSHEET")
Set Fnd = Ws1.Range("A" & Rows.Count)
Str = TextBoxCUSTOMER.Value
If Str = "" Then Exit Sub
Ws2.Cells.Clear
Qty = WorksheetFunction.CountIf(Ws1.Columns("A"), Str)
Nrow = 2
For i = 1 To Qty
Nrow = Nrow + 1
Set Fnd = Ws1.Range("A:A").Find(Str, Fnd, , xlWhole, xlByRows, xlNext, False, , False)
Ws2.Cells(Nrow, 1).Resize(, 8).Value = Fnd.Offset(, 0).Resize(, 8).Value
Next i
End Sub