Trying to automate sheets to run Macro and copy / paste

MrSams

New member
Joined
Sep 27, 2016
Messages
1
Reaction score
0
Points
0
I am trying to help a friend and this is far over my expertise so I came where the experts are for some help

I want to grab the numbers on tab “Drawn Numbers” from the bottom up I2500:O2 and place them starting with I2500:O2500 to the “Input Sheet” starting with I49:O101. (Numbers 53)
Every time we grab a row from the “Drawn Numbers” sheet I want to move each row down 1 row on the “Input” sheet and the Macro in Module 1 automatically take off running. Once complete it continues running with a new row from the “Drawn Numbers” sheet and the process starts over again.
So, row 49 on the “Input” sheet becomes numbers 52, row 50 becomes 53, row 49 becomes 54 and so on.

I know I do not have the other external sheets but I they are not needed for what I am asking for. I am basically asking to run the Drawn Numbers sheet and Input sheet automatically and start the Macro in Module 1. When it ends start the process over again

Here is the Macro in Module 1 that needs to run "after" the Input sheet and drawn Numbers sheet copy and paste data. I need help automating the Input and Drawn Numbers sheet

Code:
Option Explicit

Sub ertert()
Dim x, i&, j&
With Sheets("Counter Totals")
    x = .Range("A2:CM" & .Cells(Rows.Count, 1).End(xlUp).Row).Value
End With
For i = 1 To UBound(x)
    If (x(i, 1)) = "Game" Then j = j + 1
    If (IsNumeric(x(i, 1))) * (Len(x(i, 1))) Then
        With Sheets("Game" & x(i, 1)).Columns(1).SpecialCells(2)
            .Areas(j)(.Areas(j).Count + 1, 1).Resize(, 91).Value = Application.Index(x, i, 0)
        End With
    End If
Next i
End Sub

Sub ClearGames()
Dim wsh As Worksheet, r As Range
For Each wsh In ThisWorkbook.Sheets
    If Not wsh Is ActiveSheet Then
        For Each r In wsh.Columns(1).SpecialCells(2).Areas
            r.Resize(, 91).Offset(1).CLEAR
        Next
    End If
Next wsh
End Sub

Thanks for the help
 

Attachments

  • (Example)v1.xlsm
    327.7 KB · Views: 8
Copy 'Draw Number"!I2500:O2500
Insert a new row 49 on Input Sheet
Paste the copied data to the new row 49
Copy 'Draw Number'!I2499:O2499
Insert a new row 49 on Input Sheet
Paste the copied data to the new row 49
etc.

If that is the task it would be easier to

Inset new Rows(49).Resize(2498) on input Sheet and then copy all of 'Draw Number'!I2:O2500 to the newly inserted rows all at one time without looping.
 
Back
Top