Hi all,
Please can someone help me with the below code. As you can see I am filtering based on what is placed in the input box. The cell "I19" is blank so I want the filter to bring up any row of data in which the cell is blank in the relevant column.
I then want to copy select data out of what is filtered and paste it into a new sheet called "Outstanding Clearances".
For example, I want to copy the data in columns "A", "C", "D" and "H" then paste this data in cells "A:D" in sheet "Outstanding Clearances".
I want it to copy every row that appears in the filter. I hope this makes sense. Please see below what I have so far:
Thanks,
Eve
Please can someone help me with the below code. As you can see I am filtering based on what is placed in the input box. The cell "I19" is blank so I want the filter to bring up any row of data in which the cell is blank in the relevant column.
I then want to copy select data out of what is filtered and paste it into a new sheet called "Outstanding Clearances".
For example, I want to copy the data in columns "A", "C", "D" and "H" then paste this data in cells "A:D" in sheet "Outstanding Clearances".
I want it to copy every row that appears in the filter. I hope this makes sense. Please see below what I have so far:
Code:
Sub Button6_Click()
'
' Macro7 Macro
'
'
Dim myValue As Variant
myValue = InputBox("Enter the pre-employment clearance. E.g. References, Medical, DBS, RTW, Onboarding.", "Search outstanding pre-employment clearances")
Range("N17").Value = myValue
Range("N17").Select
If Range("N17") = "References" Then
With Sheets("HR Advice & Admin")
FilterString = Sheets("Menu").Range("I29").Value
.Range("$AC$1:$AcS$286").AutoFilter Field:=1, Criteria1:=FilterString
Intersect(.AutoFilter.Range.Offset(1), .Range("A:A")).Copy
Sheets("Outstanding clearances").Range("A2:A" & Rows.Count).SpecialCells(xlVisible)(1).PasteSpecial xlPasteValues
End With
End If
End Sub
Thanks,
Eve