Scroll down to a certain spot for 3 columns A, F & G

zone709

Well-known Member
Joined
Mar 1, 2016
Messages
2,125
Office Version
  1. 365
Platform
  1. Windows
I cleaned up as much as I can for now. I need to edit the scroll and have it end at the last row number that Column C has data in. Instead of going down to 50 as I have now.

So basically trying to scroll down columns A F & G to end when column C has data last. For example last data in column C is in row 18. So the scroll would end at row 18.

Code:
Sub MacroScroll()
    Range("A2").Copy
    Range("A3").Select
    ActiveSheet.Paste
    Range("A2:A3").AutoFill Destination:=Range("A2:A50"), Type:=xlFillDefault  '<--- Scroll
    Range("A2:A50").Select
    Range("F2").Copy
    Range("F3").Select
    ActiveSheet.Paste
    Range("F2:F3").AutoFill Destination:=Range("F2:F50"), Type:=xlFillDefault '<--- Scroll
    Range("F2:F50").Select
    Range("G2").Copy
    Range("G3").Select
    ActiveSheet.Paste
    Range("G2:G3").AutoFill Destination:=Range("G2:G50"), Type:=xlFillDefault '<--- Scroll
    Range("G2:G50").Select
    Range("G1").Select
End Sub
 
Last edited:

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
You can calculate your last row this way...

LastRow = Cells(Rows.Count, "C").End(xlUp).Row

then change "A2:A50" to "A2:A" & LastRow and then do the same for the other columns.
 
Upvote 0
Can I ask you a small question on this. Can I use the same method if I want to copy a range. Range("C2:C50").Copy ("C2:C " & LastRow). By doing this it debugs. Probably a small fix or it wont work for copy?

Thanks
 
Upvote 0
Can I ask you a small question on this. Can I use the same method if I want to copy a range.

Range("C2:C50").Copy Range("C2:C " & LastRow).

By doing this it debugs. Probably a small fix or it wont work for copy?
You forgot the Range property name (shown in red above).
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,897
Messages
6,175,270
Members
452,628
Latest member
dd2

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
Back
Top