Can't output values to cell

John787878

New Member
Joined
Aug 11, 2021
Messages
9
Office Version
  1. 365
Platform
  1. Windows
Hi,

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!
 
If it's not writing anything anywhere, then the cells do not match your criteria exactly.
 
Upvote 0

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Maybe you have stuff at the beginning or the end that you don't notice?
 
Upvote 0

Forum statistics

Threads
1,215,063
Messages
6,122,928
Members
449,094
Latest member
teemeren

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top