Announcement

Collapse
No announcement yet.

Macro to pull every Nth row of data

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Macro to pull every Nth row of data



    I have a workbook with over 20 worksheets with same columns and rows( each has its own name). There is also a master worksheet that is stacked sequentially in the same order. I need a macro to populate the range R39:AC39 in all the worksheets pulling data from the master worksheet. e.g
    Sheet 1 R39:AC39 will pull data from the master R39:AC39
    Sheet 2 R39:AC39 will pull data from the master R83:AC83
    Sheet 3 R39:AC39 will pull data from the master R127:AC127 & SO FORTH.

    Thanks!

  • #2
    Welcome to the forum!

    In a Module:
    Code:
    Sub Step44()
      Dim i As Integer, c As Long, m As Worksheet, ws As Worksheet
      
      Set m = Worksheets("Master")
      
      Application.ScreenUpdating = False
      Application.EnableEvents = False
      Application.Calculation = xlCalculationManual
      
      c = -5
      For i = 1 To Worksheets.Count
        Set ws = Worksheets(i)
        If ws.Name = "Master" Then GoTo NextI
        c = c + 44
        m.Range(m.Cells(c, "R"), m.Cells(c, "AC")).Copy ws.Range("R39")
    NextI:
      Next i
      
      Application.ScreenUpdating = True
      Application.EnableEvents = True
      Application.Calculation = xlCalculationAutomatic
      Application.CutCopyMode = False
    End Sub

    Comment


    • #3


      Awesome. Worked like a charm.
      Thanks a lot.

      Comment

      Working...
      X