Results 1 to 3 of 3
  1. #1
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    Illinois
    Posts
    552
    Thanks
    0
    Thanked 1 Time in 1 Post

    Bad VBA code (Excel xp)

    Very long code fragment moved to attachment - HansV

    I have this code that i want to make more efficient. I don't know how to cycle through letters A through N. Please let me know how i can fix this code. Thanks

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Bad VBA code (Excel xp)

    Here is a minimal adjustment:

    Dim c As Integer
    For c = Asc("A") To Asc("N")
    Set rngB = Workbooks(xlsFile).Sheets(numSheet).Range(Chrę & n1 & "," & Chrę & n2 & "," & Chrę & n3 & "," & Chrę & n4)
    i = 0
    For Each r In rngB
    'r.Select
    r.Copy
    shtSource.Range(rngS).Offset(0, i).PasteSpecial (xlPasteValues)
    i = i + 1
    Next r
    Next c

  3. #3
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    Illinois
    Posts
    552
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Bad VBA code (Excel xp)

    very cool. thanks!

Posting Permissions

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