If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > VBA code to copy non consecutive cells

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-13-11, 21:54
Frantastic Frantastic is offline
Registered User
 
Join Date: Apr 2011
Posts: 2
Question 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
Reply With Quote
  #2 (permalink)  
Old 04-14-11, 05:57
weejas weejas is offline
Registered User
 
Join Date: Sep 2006
Location: Surrey, UK
Posts: 448
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.
Reply With Quote
  #3 (permalink)  
Old 04-14-11, 19:27
Frantastic Frantastic is offline
Registered User
 
Join Date: Apr 2011
Posts: 2
Thank you, all of a sudden it is so simple!
Reply With Quote
  #4 (permalink)  
Old 04-15-11, 04:35
weejas weejas is offline
Registered User
 
Join Date: Sep 2006
Location: Surrey, UK
Posts: 448
You're welcome!
__________________
10% of magic is knowing something that no-one else does. The rest is misdirection.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On