PC Review


Reply
Thread Tools Rate Thread

Copy Selection - Paste Selection - Delete Selection

 
 
Uninvisible
Guest
Posts: n/a
 
      23rd Oct 2007
I am trying to develop a macro which will allow me to copy a vertical
selection, paste special transpose it horizontally and then want to
delete (shift cells up) the vertical selection I copied. Any thoughts
on how to put this together? I am trying to develop one macro as I
need to copy and transpose several hundere records.

 
Reply With Quote
 
 
 
 
=?Utf-8?B?Sm9lbA==?=
Guest
Posts: n/a
 
      23rd Oct 2007
The code below should help. I assumed the first cell doesn't change. the
cells beneath the active cell gets moved to the right of the active cell. I
also assumed all the cells until the first blank cell will get moved. The
xlDown get all the cells until the first empty cell.


Sub remove()

Set firstcell = ActiveCell
firstcell.Offset(1, 0).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
firstcell.Offset(0, 1).Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=True
firstcell.Offset(1, 0).Select
Range(Selection, Selection.End(xlDown)).Delete Shift:=xlUp
End Sub

"Uninvisible" wrote:

> I am trying to develop a macro which will allow me to copy a vertical
> selection, paste special transpose it horizontally and then want to
> delete (shift cells up) the vertical selection I copied. Any thoughts
> on how to put this together? I am trying to develop one macro as I
> need to copy and transpose several hundere records.
>
>

 
Reply With Quote
 
Uninvisible
Guest
Posts: n/a
 
      25th Oct 2007
Thanks. Perfect.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
XL2007, Selection.Delete deletes more than the selection xlrotor Microsoft Excel Programming 5 3rd Mar 2008 11:36 PM
Copy Selection and Append Paste ktoth04 Microsoft Access VBA Modules 5 2nd Mar 2008 07:56 PM
Copy Selection - Transpose Selection - Delete Selection Uninvisible Microsoft Excel Misc 2 23rd Oct 2007 04:18 PM
copy and paste multiple selection Gareth Microsoft Excel Programming 7 29th May 2005 12:23 AM
Copy&Paste and Selection Change Bura Tino Microsoft Excel Programming 3 22nd Nov 2003 01:35 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:50 PM.