aleksandra123
New Member
Hi I have below code. It seems work however I cannot get any result
Sub cpypstalt()
Dim s1 As Workbook, s2 As Workbook
Set s1 = Workbooks("Book1.xlsm")
Set s2 = Workbooks("Book2.xlsm")
Dim lr As Long, lr2 As Long
Dim i As Long
lr = s1.Sheets("Sheet1").Range("A" & Rows.Count).End(xlUp).Row
lr2 = 1
Application.ScreenUpdating = False
For i = 1 To lr
s2.Sheets("Sheet1").Range("A" & lr2) = s1.Sheets("Sheet1").Range("A" & i).SpecialCells(xlCellTypeVisible)
lr2 = lr2 + 2
Next i
Application.ScreenUpdating = True
End Sub
I used Special Cells (xlCellTypeVisible) as I need to copy only filtered data. However it doesn't work.
On top of that, I am trying to create macro which copy one cell A1 in let's say Workbook Book1 and copy twice to workbook Book2 and then return and copy cell A2 and paste again in the Book2 twice under the first pasting.
Anyone can help me?
Many Thanks!
Sub cpypstalt()
Dim s1 As Workbook, s2 As Workbook
Set s1 = Workbooks("Book1.xlsm")
Set s2 = Workbooks("Book2.xlsm")
Dim lr As Long, lr2 As Long
Dim i As Long
lr = s1.Sheets("Sheet1").Range("A" & Rows.Count).End(xlUp).Row
lr2 = 1
Application.ScreenUpdating = False
For i = 1 To lr
s2.Sheets("Sheet1").Range("A" & lr2) = s1.Sheets("Sheet1").Range("A" & i).SpecialCells(xlCellTypeVisible)
lr2 = lr2 + 2
Next i
Application.ScreenUpdating = True
End Sub
I used Special Cells (xlCellTypeVisible) as I need to copy only filtered data. However it doesn't work.
On top of that, I am trying to create macro which copy one cell A1 in let's say Workbook Book1 and copy twice to workbook Book2 and then return and copy cell A2 and paste again in the Book2 twice under the first pasting.
Anyone can help me?
Many Thanks!