Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 124
Default Cut a column in one line of VBA

I don't think so. I just moved column B to column A. The recorder gave me this.

Columns("B:B").Select
Selection.Cut
Columns("A:A").Select
Selection.Insert Shift:=xlToRight

That can be reduced to

Columns("B:B").Cut
Columns("A:A").Insert

but not to a single line.

You can only get it down to a single line if it it's a "regular" paste rather than an
insert-paste.



On Mon, 11 Aug 2003 12:01:09 -0700, "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.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to change bar to line in line-column on 2 axes chart in Excel2 jaysan3 Charts and Charting in Excel 2 July 2nd 08 11:13 AM
change last serie to be line in the line-column Excel chart in Wor Eric Charts and Charting in Excel 3 June 30th 07 04:58 PM
How to add a Vertical Line to a Column or Line Chart with two axes already in use? Alan Charts and Charting in Excel 6 December 13th 06 03:37 AM
Chart Type - Line Column adding a 2nd line [email protected] Charts and Charting in Excel 1 October 24th 06 04:17 PM
How do I add an extra line to a line-column chart? moose Charts and Charting in Excel 1 February 23rd 06 05:30 PM


All times are GMT +1. The time now is 08:31 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"