Hello,
I hope you can help & it may be a really easy answer, but I've looked on forums & I can't seem to find the answer to my question.
I currently have the following macro (it's not very tidy but it works fine):
Sub JobSheet()
' JobSheet Macro
'
Sheets("Enquiries").Select
Range("A10").Select
With ActiveSheet
Set Rng = .UsedRange
With Rng
.AutoFilter Field:=7, Criteria1:=Array( _
"Awaiting Response", "Being Repaired", "Logged"), Operator:=xlFilterValues
.Offset(1, 0).Resize(.Rows.Count - 1, .Columns.Count) _
.SpecialCells(xlCellTypeVisible).Copy
Sheets("Job Sheet").Select
Range("A9").Select
ActiveSheet.Paste
Sheets("Enquiries").Select
.AutoFilter Field:=7
Sheets("Job Sheet").Select
Range("A9").Select
Rows("6:14").Select
Selection.Delete Shift:=xlUp
Range("D7").Select
Columns("A:H").EntireColumn.AutoFit
End With
End With
End Sub
As I say it's working fine & copying all the data across, but it's also copying the blank cells underneath the filtered results. I think it's possibly because the blank cells underneath are formatted ie they have a black border. Is it possible to copy only the cells containing data?
I have tried using 'LastCell' & End(xlup) but I'm quite new to macros & VBA and have failed.
If someone could help me, I'd be really grateful & you would be saving me a lot of time!
Thank you
I hope you can help & it may be a really easy answer, but I've looked on forums & I can't seem to find the answer to my question.
I currently have the following macro (it's not very tidy but it works fine):
Sub JobSheet()
' JobSheet Macro
'
Sheets("Enquiries").Select
Range("A10").Select
With ActiveSheet
Set Rng = .UsedRange
With Rng
.AutoFilter Field:=7, Criteria1:=Array( _
"Awaiting Response", "Being Repaired", "Logged"), Operator:=xlFilterValues
.Offset(1, 0).Resize(.Rows.Count - 1, .Columns.Count) _
.SpecialCells(xlCellTypeVisible).Copy
Sheets("Job Sheet").Select
Range("A9").Select
ActiveSheet.Paste
Sheets("Enquiries").Select
.AutoFilter Field:=7
Sheets("Job Sheet").Select
Range("A9").Select
Rows("6:14").Select
Selection.Delete Shift:=xlUp
Range("D7").Select
Columns("A:H").EntireColumn.AutoFit
End With
End With
End Sub
As I say it's working fine & copying all the data across, but it's also copying the blank cells underneath the filtered results. I think it's possibly because the blank cells underneath are formatted ie they have a black border. Is it possible to copy only the cells containing data?
I have tried using 'LastCell' & End(xlup) but I'm quite new to macros & VBA and have failed.
If someone could help me, I'd be really grateful & you would be saving me a lot of time!
Thank you