Hi guys
I have this code from a professional member of mrexcel, this is i have, page 1 different and page 2. I want when fill page 2 in row 73 belong print sheet and row 66 belong main sheet (that about link data from main sheet, you know it) copy page 2 and paste from cell A75 or row 75 (after page 2 without any skip row), and next page 3 fill in row 107 belong print sheet and row 98 belong main sheet, if happened doing correctly automatic drag and fill, like before copy page 2 and paste after page 3, if not, copy page 3 and paste after that, and next...
however i have this code but just doing this function by run a macro...
anyway that is automatically do without run and just doing with vba? and can anybody hide sheet2 in this code in the tab sheet??
I have this code from a professional member of mrexcel, this is i have, page 1 different and page 2. I want when fill page 2 in row 73 belong print sheet and row 66 belong main sheet (that about link data from main sheet, you know it) copy page 2 and paste from cell A75 or row 75 (after page 2 without any skip row), and next page 3 fill in row 107 belong print sheet and row 98 belong main sheet, if happened doing correctly automatic drag and fill, like before copy page 2 and paste after page 3, if not, copy page 3 and paste after that, and next...
however i have this code but just doing this function by run a macro...
anyway that is automatically do without run and just doing with vba? and can anybody hide sheet2 in this code in the tab sheet??
VBA Code:
Sub MyCopyRange()
Dim nr As Long
Dim i As Long
Application.ScreenUpdating = False
' Set initial value of next row
nr = 34
' Copy range
For i = 2 To 30840 Step 1
' Copy Range based Cell B66 & B98
If Sheets("sheet1").Range("B" & (nr - 2) * i + 2).Value <> "" Then
Sheets("sheet2").Range("A" & nr * (i - 1) + 7 & ":H" & nr * i + 6).Copy Sheets("sheet2").Range("A" & nr * i + 7)
' Add 34 to next row
Else
Exit Sub
End If
Next i
Application.ScreenUpdating = True
End Sub