copy different cells from 1 sheet to another

K

Khalil Handal

Is there a way to copy a range of non adjasent cells from one sheet to
another without moving back and forth between the 2 sheets?
i.e.
copy D15 from sheet1 to K17 in sheet2
copy G10 from sheet1 to M17 in sheet2
copy range starting E21 until first empty line from sheet1 to colomn I in
sheet2 starting the first empty line in that colomn.
copy range starting C21 until first empty line from sheet1 to colomn F in
sheet2 starting the first empty line in that colomn.
 
D

Don Guillett

try this
Sub copyshttosht()'from source sheet
With Sheets("DestinationSheetName")
range("D15").copy .range("k17")
range("g10").copy .range("m17")

lr = .Cells(Rows.Count, "I").End(xlUp).Row + 1
Range("e21:e" & Cells(21, "e").End(xlDown).Row).Copy .Cells(lr, "I")

lr = .Cells(Rows.Count, "f").End(xlUp).Row + 1
Range("c21:c" & Cells(21, "c").End(xlDown).Row).Copy .Cells(lr, "f")

End With
End Sub
 
K

Khalil Handal

Thanks

Don Guillett said:
try this
Sub copyshttosht()'from source sheet
With Sheets("DestinationSheetName")
range("D15").copy .range("k17")
range("g10").copy .range("m17")

lr = .Cells(Rows.Count, "I").End(xlUp).Row + 1
Range("e21:e" & Cells(21, "e").End(xlDown).Row).Copy .Cells(lr, "I")

lr = .Cells(Rows.Count, "f").End(xlUp).Row + 1
Range("c21:c" & Cells(21, "c").End(xlDown).Row).Copy .Cells(lr, "f")

End With
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top