Thread: Copy in a range
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Mike H Mike H is offline
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.