Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default copy current cells to the right

Hello everybody,

Hope someone will help...
I have a worksheet with 4 columns of data. I want to
write a macro to copy the data on the first 3 columns,
current row, and then paste them 1 cell to the right.

For example, if the current cell is on row 3:
copy A3, B3, C3
paste to B3, C3, D3

if the current cell is row 10:
copy A10, B10, C10
paste to B10, C10, D10

Second question:
How should I change the macro if I don't have a fix column
reference?
For example, if the current cell is on B3:
copy B3, C3, D3
paste to C3, D3, E3

if the current cell is on D4:
copy D4, E4, F4
paste to E4, F4, G4

I am using Excel 2000 & 2002.

Many thanks,
Marisa

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default copy current cells to the right

Hi,

One way

Sub RightMove
Dim Rw, Col
Rw=Activecell.Row: Col=Activecell.Column
Range(Cells(Rw, Col), Cells(Rw, Col+2)).Copy Cells(Rw, Col+1)
End Sub

Should you wish to delete the now duplicated first cell insert

Cells(Rw, Col) = ""

before End Sub

regards,
Don
--

"Marisa" wrote in message
...
Hello everybody,

Hope someone will help...
I have a worksheet with 4 columns of data. I want to
write a macro to copy the data on the first 3 columns,
current row, and then paste them 1 cell to the right.

For example, if the current cell is on row 3:
copy A3, B3, C3
paste to B3, C3, D3

if the current cell is row 10:
copy A10, B10, C10
paste to B10, C10, D10

Second question:
How should I change the macro if I don't have a fix column
reference?
For example, if the current cell is on B3:
copy B3, C3, D3
paste to C3, D3, E3

if the current cell is on D4:
copy D4, E4, F4
paste to E4, F4, G4

I am using Excel 2000 & 2002.

Many thanks,
Marisa



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default copy current cells to the right

Thanks a lot, Don. That's very helpful.
Marisa
-----Original Message-----
Hi,

One way

Sub RightMove
Dim Rw, Col
Rw=Activecell.Row: Col=Activecell.Column
Range(Cells(Rw, Col), Cells(Rw, Col+2)).Copy Cells(Rw,

Col+1)
End Sub

Should you wish to delete the now duplicated first cell

insert

Cells(Rw, Col) = ""

before End Sub

regards,
Don
--

"Marisa" wrote in message
...
Hello everybody,

Hope someone will help...
I have a worksheet with 4 columns of data. I want to
write a macro to copy the data on the first 3 columns,
current row, and then paste them 1 cell to the right.

For example, if the current cell is on row 3:
copy A3, B3, C3
paste to B3, C3, D3

if the current cell is row 10:
copy A10, B10, C10
paste to B10, C10, D10

Second question:
How should I change the macro if I don't have a fix

column
reference?
For example, if the current cell is on B3:
copy B3, C3, D3
paste to C3, D3, E3

if the current cell is on D4:
copy D4, E4, F4
paste to E4, F4, G4

I am using Excel 2000 & 2002.

Many thanks,
Marisa



.

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
Copy worksheet into current workbook Gerard Excel Discussion (Misc queries) 0 February 19th 10 03:31 PM
Is there a COMMAND to stop a current process in Excel(Copy/Delete/ Stegra Excel Discussion (Misc queries) 1 January 13th 09 02:52 PM
Copy current row to clipboard and delete row GKW in GA Excel Discussion (Misc queries) 4 April 19th 08 06:37 PM
get a column of cells to add if current month Mike Pearson Excel Worksheet Functions 7 June 1st 07 10:31 AM
Adding to current cells Tom Excel Worksheet Functions 5 January 29th 07 01:39 AM


All times are GMT +1. The time now is 01:22 AM.

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

About Us

"It's about Microsoft Excel"