Copy Selection - Paste Selection - Delete Selection
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. |
Copy Selection - Paste Selection - Delete Selection
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. |
Copy Selection - Paste Selection - Delete Selection
Thanks. Perfect.
|
All times are GMT +1. The time now is 09:58 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com