ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Cut a column in one line of VBA (https://www.excelbanter.com/excel-programming/274163-re-cut-column-one-line-vba.html)

Myrna Larson[_2_]

Cut a column in one line of VBA
 
Unfortunately that doesn't do an INSERT/PASTE, just a PASTE, so it isn't a "move".

On Mon, 11 Aug 2003 12:47:40 -0700, keepitcool wrote:


Sub MoveIt()
[B:C].Cut [O:P]
End Sub

sorry, couldn't get it any shorter :)



keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"PK" wrote:

Hello,

I can move a column in VBA, but the macro recorder does it
in four lines of code. To be more efficient, I'm sure it
can be accomplished in a single VBA code line.

PLEASE NOTE: I want to CUT two adjoining columns (e.g. B:C)
and MOVE them by INSERTING them into a new location (e.g.
O:P). When all is said and done, the original
columns "B:C" will be gone (i.e. the spreadsheet will have
shifted to the left to absorb the empty columns created by
cutting columns "B:C" out), and columns "O:P" will now
contain the cut data and the original data in "O" will
still be there, only shifted to the right. Can this be
accomplished in a single VBA line?

Your example code is most appreciated. Thanks in advance.



keepITcool

Cut a column in one line of VBA
 
yes Myrna..

saw your other post and realized my mistake.
no need to rub it in :)



keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


Myrna Larson wrote:

Unfortunately that doesn't do an INSERT/PASTE, just a PASTE, so it
isn't a "move".

On Mon, 11 Aug 2003 12:47:40 -0700, keepitcool
wrote:


Sub MoveIt()
[B:C].Cut [O:P]
End Sub

sorry, couldn't get it any shorter :)




All times are GMT +1. The time now is 03:44 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com