Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
RANGE EXCEL copy cell that meets criteria in a range | Excel Worksheet Functions | |||
copy formulas from a contiguous range to a safe place and copy them back later | Excel Programming | |||
Create/copy combo boxes in one range if condition is met in a different range | Excel Programming | |||
Code to copy range vs Copy Entire Worksheet - can't figure it out | Excel Programming | |||
Range COPY function - how to copy VALUES and not formulas | Excel Programming |