shiva_reshs
Board Regular
- Joined
- Sep 5, 2012
- Messages
- 68
Hello,
Whats wrong with my sumif function?
Whats wrong with my sumif function?
Code:
Sub update2()Dim x As Workbook
Dim y As Workbook
ImportDir1 = Trim(Sheets("Control").Range("H6").Value)
Application.DisplayAlerts = False
Set x = Workbooks.Open(ImportDir1 & "\" & Sheets("Control").Range("C6").Value & ".xlsx")
With x.Sheets(1)
Sheets(1).AutoFilterMode = False
End With
Application.DisplayAlerts = True
'x.Close
Workbooks("Validation.xlsm").Activate
Application.DisplayAlerts = False
Set y = Workbooks.Open(ImportDir1 & "\" & Trim(Sheets("Control").Range("C7").Value) & ".xlsx")
Application.DisplayAlerts = True
With y.Sheets(1)
Sheets(1).AutoFilterMode = False
End With
Dim lastrow As Long
Dim i As Long
x.Activate
lastrow = Range("B" & Rows.Count).End(xlUp).Row
For i = 8 To lastrow
If Range("B" & i).Value <> "" Then
Range("Y" & i).Formula = "=IFERROR(VLOOKUP(RC[-23],'[" & y.Name & "]July 18 OT New Formula'!C2:C13,8,0),0)"
Range("AB" & i).Formula = "=IFERROR(VLOOKUP(RC[-26],'[" & y.Name & "]July18 Night Shift Allowance'!C2:C13,6,0),0)"
[COLOR=#b22222] Range("AV" & i).Formula = "=IFERROR(SUMIFS('[" & y.Name & "]Medical Claim'!C8,'[" & y.Name & "]Medical Claim'!C2,RC[-46],0)"[/COLOR]
Range("AW" & i).Formula = "=IFERROR(VLOOKUP(RC[-47],'[" & y.Name & "]Meal Allowance '!C2:C13,6,0),0)"
End If
Next i