Copy to the last piece of data

Can I select a range to copy to the last item?

Sheets("Design").Select
Range("A1:C200").Copy

'My data only runs until E48 and Im left with 152 blancs.

So now it copies from A1 to E200, but how can I edit the code above, so it only selects the last piece of data, which in my case is E48? (this is a variable)

Thank!

@Jean

In my excel sheet, I have data running from A1-A18, B is empty and C1-C2. Now I would like to copy all the cells that contain the value.

 With Range("A1")
     Range(.Cells(1, 1), .End(xlDown).Cells(20, 3)).Copy
 End With

This will copy everything from A1-C20, but I want only A1-A18 and C1-C2, as if they contained data. But it must be formed in such a way that as soon as I have data in B or my range, they will also be copied.

Perhaps this is a little clearer?

About the situation with copy / paste;

I am currently using this

appWD.Selection.PasteSpecial ' So it copies the formats too?
'In your case, do you mean I should do it like this?
Range(.Cells(1, 1), .End(xlDown).Cells(20, 3)).Copy Destination:=appWD.Selection.PasteSpecial
0
3

:

With Range("A1")
    Range(.Cells(1, 1), .End(xlDown).Cells(1, 5)).Copy
End With

"5", .

, : /, ! . / , . , ..

Range(.Cells(1, 1), .End(xlDown).Cells(1, 5)).Copy myDestinationRange

Range(.Cells(1, 1), .End(xlDown).Cells(1, 5)).Copy
myDestinationRange.Paste

, - .

+2

:

a1 = Range("a1").Address
lastcell = Range("E1").End(xlDown).Address
Range(a1, lastcell).Copy
+2

, CurrentRegion:

Range("A1").CurrentRegion.Copy Destination:=Sheet2.Range("a1")
0

All Articles