Consulting

Results 1 to 4 of 4

Thread: Can't output values to cell

  1. #1

    Question Can't output values to cell

    Hi,

    I have tried everything, but my code just won't work:




    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




    Pls help
    Last edited by Paul_Hossler; 08-12-2021 at 11:37 AM.

  2. #2
    Knowledge Base Approver VBAX Wizard
    Joined
    Apr 2012
    Posts
    5,642
    sn = cells(2,1).resize(10002,3)
    
    for j=1 to ubound(sn)
      if instr("LuxWarChi",left(sn(j,1),3))*instr("DüsFar",left(sn(j,2),3)) then sn(j,1)=sn(j,3)
    next
    
    cells(2,8).resize(10002) = sn

  3. #3
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,873
    Cross posted in several places.

  4. #4
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,724
    Location
    Quote Originally Posted by John18188181 View Post
    Hi,

    I have tried everything, but my code just won't work:

    Pls help
    Welcome to the forum

    Take a minute to read the FAQs at the link in my signature, especially the parts about using CODE tags and cross-posting in other forums
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •