Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2011
    Posts
    2

    Question Unanswered: VBA code to copy non consecutive cells

    I am completely new to VB so I apologies if this seems like a ridiculous question.

    All I am trying to do is select the last used cell in a column and then copy some non-consecutive cells within that same row. The cells I need are from columns A,E,F,M and P. The purpose of this is to transpose on to another worksheet, I have this code and need no assistance with this it is just selecting and copying the non consecutive cells that I am having the issue with.

    This is my code which at the moment only finds, selects and copies the last cell in column A.

    Range("A6").Select
    Cells(Cells.Rows.Count, "A").End(xlUp).Select
    Selection.Copy
    Sheets("Info Transfer").Select
    Range("D4").Select
    Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
    False, Transpose:=True
    Range("D4").Select

    I would be really grateful for some help on this.

    Thank You

  2. #2
    Join Date
    Sep 2006
    Location
    Surrey, UK
    Posts
    995
    Provided Answers: 2
    If you find and select the cell in column A that starts the row, you can use ActiveCell.Offset(rows, columns) to transfer the information:
    Sheets("Info Transfer").Range("D4") = ActiveCell.Value
    Sheets("Info Transfer").Range("D5") = ActiveCell.Offset(0, 4).Value
    Etc
    10% of magic is knowing something that no-one else does. The rest is misdirection.

  3. #3
    Join Date
    Apr 2011
    Posts
    2
    Thank you, all of a sudden it is so simple!

  4. #4
    Join Date
    Sep 2006
    Location
    Surrey, UK
    Posts
    995
    Provided Answers: 2
    You're welcome!
    10% of magic is knowing something that no-one else does. The rest is misdirection.

Posting Permissions

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