View Single Post
 
Old 03-24-2017, 06:49 PM
altina altina is offline Windows 10 Office 2016
Novice
 
Join Date: Mar 2017
Posts: 1
altina is on a distinguished road
Question loop code until the first empty row

Could you please help me write a loop code for this sequence?

I copy the table Y1:AT4 (containing information from the table A2:X8
I insert the information of consecutive rows:
Range("A4:V4").Select
Range("A5:V5").Select
Range("A6:V6").Select

Until the first empty row.
And I copy a value and paste it in the new table,

Thank you

here is the code:

Code:
Range("Y1:AT4").Select
    Selection.Copy
    Range("Y6").Select
    ActiveSheet.Paste
    Range("A4:V4").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("Y8").Select
    ActiveSheet.Paste
    Range("AT9").Select
    Application.CutCopyMode = False
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = "=R[-5]C[-22]"
Range("Y1:AT4").Select
    Selection.Copy
    Range("Y11").Select
    ActiveSheet.Paste
    Range("A5:V5").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("Y13").Select
    ActiveSheet.Paste
    Range("AT14").Select
    Application.CutCopyMode = False
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = "=R[-9]C[-22]"
Range("Y1:AT4").Select
    Selection.Copy
    ActiveWindow.SmallScroll Down:=2
    Range("Y16").Select
    ActiveSheet.Paste
    Range("A6:V6").Select
    Application.CutCopyMode = False
    Selection.Copy
    ActiveWindow.SmallScroll Down:=3
    Range("Y18").Select
    ActiveSheet.Paste
    Range("AT19").Select
    Application.CutCopyMode = False
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = "=R[-13]C[-22]"
    Range("AT20").Select
    ActiveWindow.SmallScroll Down:=-12

Last edited by macropod; 03-25-2017 at 12:27 AM. Reason: Added code tags
Reply With Quote