Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 88854

How can I write a loop to copy and paste multiple rows in excel?

$
0
0

So I have a very long table and I want to fit every 90 of cells on one page. I tried to write a loop to copy and paste every 45 rows a time but I don't really know how to. Any help will be much appreciated! Thank you in advance.

Sub Macro2()

    Range("A47:C92").Select         (I selected 45 rows a time)
    Selection.Cut
    Range("E1").Select             
    ActiveSheet.Paste
    Columns("F:F").ColumnWidth = 15.67
    Range("A47:C92").Select
    Selection.Delete Shift:=xlUp

    Range("A93:C138").Select
    Selection.Cut
    Range("E47").Select
    ActiveSheet.Paste
    Range("A93:C138").Select
    Selection.Delete Shift:=xlUp

    Range("A139:C184").Select
    Selection.Cut
    Range("E93").Select
    ActiveSheet.Paste
    Range("A139:C184").Select
    Selection.Delete Shift:=xlUp
End Sub

Viewing all articles
Browse latest Browse all 88854


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>