thedeadzeds
Active Member
- Joined
- Aug 16, 2011
- Messages
- 451
- Office Version
- 365
- Platform
- Windows
Hi Guys,
I'm struggling how to add some additional code to the below. Essentially, if the formula in Allocate!e16 is equal to blank, then do nothing, else run the below: The formula is Allocate!e16 is
I'm struggling how to add some additional code to the below. Essentially, if the formula in Allocate!e16 is equal to blank, then do nothing, else run the below: The formula is Allocate!e16 is
Code:
=IF(E16<>0, D16, "")
Code:
Sub Payam_Naeini_New_Calls_Service_and_MOT()'Payam Naeini
Application.ScreenUpdating = False
Dim sh1 As Worksheet, sh2 As Worksheet
Dim i As Long, j As Long
Set sh1 = Sheets("Audi SMOT NC Values")
Set sh2 = Sheets("All Data")
'Filter New Call
Sheets("Audi SMOT NC Values").Select
ActiveSheet.Range("$A$1:$P$5000").AutoFilter Field:=4, _
Criteria1:="New Calls"
'Filter the relevant Contcode
ActiveSheet.Range("$A$1:$P$5000").AutoFilter Field:=13, _
Criteria1:=Array("Kerridge MOT", "Kerridge Service & MOT", "Non Fran Service & MOT", "Non Fran Service", "Polk MOT", _
"Polk Service & MOT", "Polk Service", "React MOT", "React Service & MOT", "React Service", "MOT", "Service", "Kerridge Service"), Operator:=xlFilterValues
'Filter by person
ActiveSheet.Range("$A$1:$P$5000").AutoFilter Field:=16, _
Criteria1:=Array("Payam Naeini")
i = 1
For j = 2 To Rows.Count
If sh1.Cells(j, 1).EntireRow.Hidden = False Then
sh1.Cells(j, 1).EntireRow.Copy
sh2.Cells(Rows.Count, 1).End(xlUp).Offset(1).PasteSpecial xlPasteValues
i = i + 1
If i = Range("Allocate!e16").Value + 1 Then Exit Sub
End If
Next j
Application.ScreenUpdating = True
End Sub