I have a sheet with data, where I want to copy only visible cells to an new sheet. There are already hidden rows (through filtering), but I need to hide additional rows, as well as the columns I don't need.
The reason I paste as picture is that I want the copied cells to look exactly like in the original sheet, values and formatting.
The new sheet will be converted into a pdf file (code not included here)
Now, this works for the ROWS but not for the COLUMNS, i.e. the columns remain in the new sheet. Odd thing is, in an earlier version I only used the code for the columns, and it worked fine.
Any ideas?
The reason I paste as picture is that I want the copied cells to look exactly like in the original sheet, values and formatting.
The new sheet will be converted into a pdf file (code not included here)
Code:
Sheets.Add.Name = "shttemp"
Sheets("Sheet3").Select
Dim LR As Long
LR = Columns("A:A").Find("*", SearchDirection:=xlPrevious, SearchOrder:=xlByRows).Row
With ActiveSheet
Range("B:B, D:D, F:F").Select
Selection.EntireColumn.Hidden = True
Rows(LR + 1 & ":600").Select
Selection.EntireRow.Hidden = True
Range("A3:M500").Select
Selection.SpecialCells(xlCellTypeVisible).Select
Selection.Copy
Sheets("shttemp").Select
Range("A1").Select
ActiveSheet.Pictures.Paste.Select
End With
Sheets("Sheet3").Select
Range("B:B, D:D, F:F").Select
Selection.EntireColumn.Hidden = False
Sheets("Sheet3").Select
Rows(LR + 1 & ":600").Select
Selection.EntireRow.Hidden = False
Sheets("shttemp").Select
Now, this works for the ROWS but not for the COLUMNS, i.e. the columns remain in the new sheet. Odd thing is, in an earlier version I only used the code for the columns, and it worked fine.
Any ideas?