Copy Paste to a range

niha

New Member
Joined
May 6, 2021
Messages
19
Office Version
  1. 2019
Platform
  1. Windows
Hi guys!
I want to find the last filled cell in column H, then find the last filled cell in column E i.e the date and paste it till column H's last filled row in column E. I am not able to fill all the cells in the range. I attached the copy of how I want it in the sheet.

Using this
VBA Code:
Sub copynow()
   Cells(Rows.Count, "H").End(xlUp).Select
   a = ActiveCell.Row
   ActiveCell.Offset(0, -3).Select
   Cells(Rows.Count, "E").End(xlUp).Select
   ActiveCell.Copy
Cells(Rows.Count, "H").End(xlUp).Select
ActiveCell.Offset(0, -3).Select
ActiveSheet.Paste
End Sub
 

Attachments

  • Capture.JPG
    Capture.JPG
    31.1 KB · Views: 5
  • Capture 2.JPG
    Capture 2.JPG
    34.1 KB · Views: 5

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.

AlphaFrog

MrExcel MVP
Joined
Sep 2, 2009
Messages
16,434
VBA Code:
Sub copynow()
    Range(Cells(Rows.Count, "E").End(xlUp), Cells(Rows.Count, "H").End(xlUp).Offset(0, -3)).Value = _
        Cells(Rows.Count, "E").End(xlUp).Value
End Sub
 

niha

New Member
Joined
May 6, 2021
Messages
19
Office Version
  1. 2019
Platform
  1. Windows
Thanks A lott!!
This is Perfect!
Need some more help on this though. So basically I wanted to sort everything from D:H based on these dates which is why I needed them to be copied in the first place.
Like everything in rows of date 5/12/21 must be above 5/13/21 dates. Something like this.
 

Attachments

  • 11.jpg
    11.jpg
    67.4 KB · Views: 4
  • 2.JPG
    2.JPG
    52.7 KB · Views: 4

AlphaFrog

MrExcel MVP
Joined
Sep 2, 2009
Messages
16,434
VBA Code:
Sub copynow()
    Range(Cells(Rows.Count, "E").End(xlUp), Cells(Rows.Count, "H").End(xlUp).Offset(0, -3)).Value = _
        Cells(Rows.Count, "E").End(xlUp).Value
        
    Range("D:H").Sort Key1:=Range("E1"), Order1:=xlAscending, Header:=xlGuess
    
End Sub
 
Solution

niha

New Member
Joined
May 6, 2021
Messages
19
Office Version
  1. 2019
Platform
  1. Windows
Works Perfect! Thanks a lot!
 

Forum statistics

Threads
1,144,679
Messages
5,725,738
Members
422,636
Latest member
GatorsBucs

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top