Hello. I have this code to copy only the data shown in the same format to Sheet 2 I want to modify the code so that I can copy the data with an empty row between all the copied rows
As for adding empty rows, I used this code, but it is slow due to the number of rows copied
VBA Code:
Sub COPY()
Dim SH1 As Worksheet, SH2 As Worksheet
Dim lr As String
Set SH1 = Sheet1
Set SH2 = sheet2
lr = SH1.Range("A5").SpecialCells(xlCellTypeLastCell).Address
SH2.Cells.Clear
SH1.Range("A5:" & lr).SpecialCells(xlCellTypeVisible).COPY _
Destination:=SH2.Range("A5")
SH1.Range("A5:G5").COPY Destination:=SH2.Range("A5")
Application.CutCopyMode = Fals
SH2.Columns("A:G").EntireColumn.AutoFit
End Sub
As for adding empty rows, I used this code, but it is slow due to the number of rows copied
Code:
Dim r As Long, y As Long
y = SH2.Range("A" & SH2.Rows.Count).End(xlUp).Row
For r = y To 7 Step -1
SH2.Cells(r, 1).EntireRow.Insert Shift:=xlDown
Next r