Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Copy in a range

Hello,
I'm trying to do a macro VBA for that:

There is a range in a sheet that I don't know how many rows it has.
I want to copy cells from column D to column C (for example), but only in
the range, becouse there's another data in this D and C columns out of the
range.

Can anybody help me?
Thank you very much.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Copy in a range

Hi,

I'm not sure I completely understand but I think you mean you have date in
column D then a gap then more data and you only want to copy the first
portion of the data and this may help.

Sub prime()
lastrow = Range("D1").End(xlDown).Row
Set myrange = Range("D1:D" & lastrow)
For Each c In myrange
c.Offset(, -1).Value = c.Value
Next
End Sub

Right click you sheet tab, view code and psate this in.

Mike

"moixerno" wrote:

Hello,
I'm trying to do a macro VBA for that:

There is a range in a sheet that I don't know how many rows it has.
I want to copy cells from column D to column C (for example), but only in
the range, becouse there's another data in this D and C columns out of the
range.

Can anybody help me?
Thank you very much.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Copy in a range

Thanks Mike. It works very well.

Moixerno

"Mike H" wrote:

Hi,

I'm not sure I completely understand but I think you mean you have date in
column D then a gap then more data and you only want to copy the first
portion of the data and this may help.

Sub prime()
lastrow = Range("D1").End(xlDown).Row
Set myrange = Range("D1:D" & lastrow)
For Each c In myrange
c.Offset(, -1).Value = c.Value
Next
End Sub

Right click you sheet tab, view code and psate this in.

Mike

"moixerno" wrote:

Hello,
I'm trying to do a macro VBA for that:

There is a range in a sheet that I don't know how many rows it has.
I want to copy cells from column D to column C (for example), but only in
the range, becouse there's another data in this D and C columns out of the
range.

Can anybody help me?
Thank you very much.

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
RANGE EXCEL copy cell that meets criteria in a range confused Excel Worksheet Functions 3 March 27th 08 01:41 PM
copy formulas from a contiguous range to a safe place and copy them back later Lucas Budlong Excel Programming 2 February 22nd 06 08:26 PM
Create/copy combo boxes in one range if condition is met in a different range LB[_4_] Excel Programming 4 September 30th 05 12:21 AM
Code to copy range vs Copy Entire Worksheet - can't figure it out Mike Taylor Excel Programming 1 April 15th 04 08:34 PM
Range COPY function - how to copy VALUES and not formulas James Cooke Excel Programming 1 August 21st 03 07:04 PM


All times are GMT +1. The time now is 02:27 PM.

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"