DJMXM
New Member
- Joined
- Jun 19, 2013
- Messages
- 45
Good Morning Everyone - I have been working on a Maco that no matter which way I set the after:=wsSource.Range - Either ("AI90" or "AI94") all I get is one entry copied even tho there are more than one items that set to TRUE.
The Macro won't loop an find all items. Thank You in advance for your help!!
The Macro won't loop an find all items. Thank You in advance for your help!!
Code:
Sub BEOA9()
Dim wsSource As Worksheet
Dim wsDest As Worksheet
Dim FoundX As Range
Dim FirstFound As String
Dim Lastrow As Long
Application.ScreenUpdating = False
Set wsSource = Worksheets("Catering and Rental Worksheet")
Set wsDest = Worksheets("Catering BEO")
' Food Manual Input Section
Set FoundX = wsSource.Range("AI90:AI94").Find(What:="TRUE", after:=wsSource.Range("AI90"), _
LookAt:=xlPart, SearchDirection:=xlNext, MatchCase:=False)
If FoundX Is Nothing Then
Exit Sub
Else
FirstFound = FoundX.Address
Lastrow = wsDest.Range("O" & Rows.Count).End(xlUp).Row + 1
If Lastrow < 3 Then Lastrow = 3
Do
wsDest.Range("O" & Lastrow).Resize(1, 6).Value = FoundX.Offset(0, -7).Resize(1, 6).Value
Set FoundX = wsSource.Range("AI90:AI94").FindNext(FoundX)
Loop Until FoundX.Address = FirstFound
End If
End Sub