johnbird1988
Board Regular
- Joined
- Oct 6, 2009
- Messages
- 199
Hello,
I am try to copy only visible cells from and excel filtered table and paste them as values into another workbook. I would like to do this without using the clipboard but can not get the code to work.
I am trying:
The code opens the file and filters the data set but does not copy and paste the data.
Any help or advise would be grateful,
Cheers
john
I am try to copy only visible cells from and excel filtered table and paste them as values into another workbook. I would like to do this without using the clipboard but can not get the code to work.
I am trying:
Code:
Set wb = Workbooks.Open(SourceFolder & "\" & xlo)
For Each sht In Sheets
If sht.Name = "Report" Then
srow = sht.UsedRange.Rows(sht.UsedRange.Rows.Count).Row
scol = sht.UsedRange.Columns(sht.UsedRange.Columns.Count).Column
wb.Sheets("Report").AutoFilterMode = False
wb.Sheets("Report").Range(Cells(1, 1), Cells(srow, scol)).AutoFilter Field:=15, Criteria1:="=BIM" _
, Operator:=xlOr, Criteria2:="=Report"
Windows(decomp).Activate
wb.Sheets("Report").Range(Cells(1, 1), Cells(srow, scol)).SpecialCells(xlCellTypeVisible).Copy ThisWorkbook.Sheets(12).Range("A1")
wb.Close False
End If
Next sht
The code opens the file and filters the data set but does not copy and paste the data.
Any help or advise would be grateful,
Cheers
john