The following code works fine for EntireRow.Copy
But I want to copy only the cells that have values in them (copying entire row is screwing up the auto expandable table in the other sheet)
Error says "Method range of obect workseet failed"
Sub exa()
Dim row As Long
Dim col As Long
With Sheet1 'or ThisWorkbook.Worksheets("Sheet1")
row = .Range("A" & Rows.Count).End(xlUp).row
col = .Range("1" & Columns.Count).End(xlToLeft).Column
If Not row > 1 Then Exit Sub
.Range("A2:A" & row).SpecialCells(xlCellTypeVisible).Range("1:1" & col).Copy _
ThisWorkbook.Worksheets("Sheet2").Cells(2, 1)
End With
End Sub
But I want to copy only the cells that have values in them (copying entire row is screwing up the auto expandable table in the other sheet)
Error says "Method range of obect workseet failed"
Sub exa()
Dim row As Long
Dim col As Long
With Sheet1 'or ThisWorkbook.Worksheets("Sheet1")
row = .Range("A" & Rows.Count).End(xlUp).row
col = .Range("1" & Columns.Count).End(xlToLeft).Column
If Not row > 1 Then Exit Sub
.Range("A2:A" & row).SpecialCells(xlCellTypeVisible).Range("1:1" & col).Copy _
ThisWorkbook.Worksheets("Sheet2").Cells(2, 1)
End With
End Sub