John787878
New Member
- Joined
- Aug 11, 2021
- Messages
- 9
- Office Version
- 365
- Platform
- Windows
Hi,
I have tried everything, but my code just won't work:
It should output following:
Chicago
Faroe Islands
DN3463
Warsaw
Faroe Islands
BC3497
Luxembourg
Faroe Islands
BF6959
Chicago
Dusseldorf
HK9783
Warsaw
Dusseldorf
VC1015
Pls help!
I have tried everything, but my code just won't work:
VBA Code:
Option Explicit
Sub Fly()
Dim r As Integer
Dim c As Integer
Dim Number As Single
Number = 10002
ReDim Flylist(1 To Number, 1 To 3) As String
For r = 1 To Number
For c = 1 To 3
Flylist(r, c) = Cells(r + 1, c)
Next c
Next r
For r = 1 To Number
For c = 1 To 3
If ((Cells(r + 1, 1) = "Luxembourg") Or (Cells(r + 1, 1) = "Warsaw") Or (Cells(r + 1, 1) = "Chicago")) _
And ((Cells(r + 1, 2) = "Dusseldorf") Or (Cells(r + 1, 2) = "Faroe Islands")) Then
Cells(r + 1, c + 8) = Flylist(r, c)
End If
Next c
Next r
End Sub
It should output following:
Chicago
Faroe Islands
DN3463
Warsaw
Faroe Islands
BC3497
Luxembourg
Faroe Islands
BF6959
Chicago
Dusseldorf
HK9783
Warsaw
Dusseldorf
VC1015
Pls help!