Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Junior Member
 
Posts: 10
Post Excel macro to copy the rightmost column to a new column

Hi all,


I need a excel macro to copy the 3 rightmost columns to next 3 columns.


Eg.


if i have data from column A to Column G then I need to copy the data from Column E to Column G to copied to
Column H to Column J.

I cant hardcode the column names in macro as the column range may vary day to day.

Is there any way this can be done in an excel macro.

Please help me in this issue
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,872
Default Excel macro to copy the rightmost column to a new column

Hi Vasanth,

Am Mon, 4 Jun 2012 13:10:07 +0000 schrieb Vasanth:

if i have data from column A to Column G then I need to copy the data
from Column E to Column G to copied to
Column H to Column J.


try:

LCol = Cells(1, Columns.Count).End(xlToLeft).Column
LRow = Cells(Rows.Count, 1).End(xlUp).Row

Range(Cells(1, LCol - 2), Cells(LRow, LCol)).Copy _
Destination:=Cells(1, LCol + 1)


Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2
  #3   Report Post  
Junior Member
 
Posts: 10
Smile

Thanks claus .. It worked.





Quote:
Originally Posted by Claus Busch View Post
Hi Vasanth,

Am Mon, 4 Jun 2012 13:10:07 +0000 schrieb Vasanth:

if i have data from column A to Column G then I need to copy the data
from Column E to Column G to copied to
Column H to Column J.


try:

LCol = Cells(1, Columns.Count).End(xlToLeft).Column
LRow = Cells(Rows.Count, 1).End(xlUp).Row

Range(Cells(1, LCol - 2), Cells(LRow, LCol)).Copy _
Destination:=Cells(1, LCol + 1)


Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2
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 copy one column values to another column based on conditionthat row2 contain todays date sanju[_2_] Excel Programming 3 April 16th 10 02:26 AM
Rightmost Column BillCPA Excel Discussion (Misc queries) 5 November 14th 07 07:08 PM
How do I copy a data from a single column into an array and back into another column? [email protected] Excel Programming 1 February 10th 07 05:03 AM
excel macro-copy formula to entire column? kfboudreau Excel Discussion (Misc queries) 2 February 9th 07 08:21 PM
Find specific column titles and copy the column to new workboo JLGWhiz Excel Programming 0 December 11th 06 11:23 PM


All times are GMT +1. The time now is 12:03 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"