I am trying to use an IF statment in VBS to determine if the value contained in a specific cell on "data" excel sheet matches as a known value. If it does then the data in the adjancent cells are copied and pasted into a cell in the "report" excel sheet. If no, the the default values of zero are entered into the cell in the "report" excel sheet. The problem is that the macro is not going th the next IF statement if the first IF statement is true. Here is a sample of the code:
iRow = 8
var5514a = 0
var5514d = 0
var9071a = 0
var9071d = 0
var9072a = 0
var9072d = 0
Do
Windows(dummy & ".xls").Activate
If Application.Cells(iRow, 3).Value = "5514" Then
var5514a = Application.Cells(iRow, 4).Value
var5514d = Application.Cells(iRow, 5).Value + Application.Cells(iRow, 6).Value
Windows("Ongoing Tracking - Dev.v3.xlsm").Activate
Application.Cells(iLine, 3).Value = var5514a
Application.Cells(iLine, 4).Value = var5514d
End If
Windows("Ongoing Tracking - Dev.v3.xlsm").Activate
Application.Cells(iLine, 3).Value = var5514a
Application.Cells(iLine, 4).Value = var5514d
Windows(dummy & ".xls").Activate
If Application.Cells(iRow, 3).Value = "9071" Then
var9071a = Application.Cells(iRow, 4).Value
var9071d = Application.Cells(iRow, 5).Value + Application.Cells(iRow, 6).Value
Windows("Ongoing Tracking - Dev.v3.xlsm").Activate
Application.Cells(iLine, 7).Value = var9071a
Application.Cells(iLine, 8).Value = var9071d
End If
Windows("Ongoing Tracking - Dev.v3.xlsm").Activate
Application.Cells(iLine, 7).Value = var9071a
Application.Cells(iLine, 8).Value = var9071d
Windows(dummy & ".xls").Activate
If Application.Cells(iRow, 3).Value = "9072" Then
var9072a = Application.Cells(iRow, 4).Value
var9072d = Application.Cells(iRow, 5).Value + Application.Cells(iRow, 6).Value
Windows("Ongoing Tracking - Dev.v3.xlsm").Activate
Application.Cells(iLine, 11).Value = var9072a
Application.Cells(iLine, 12).Value = var9072d
End If
iRow = 8
var5514a = 0
var5514d = 0
var9071a = 0
var9071d = 0
var9072a = 0
var9072d = 0
Do
Windows(dummy & ".xls").Activate
If Application.Cells(iRow, 3).Value = "5514" Then
var5514a = Application.Cells(iRow, 4).Value
var5514d = Application.Cells(iRow, 5).Value + Application.Cells(iRow, 6).Value
Windows("Ongoing Tracking - Dev.v3.xlsm").Activate
Application.Cells(iLine, 3).Value = var5514a
Application.Cells(iLine, 4).Value = var5514d
End If
Windows("Ongoing Tracking - Dev.v3.xlsm").Activate
Application.Cells(iLine, 3).Value = var5514a
Application.Cells(iLine, 4).Value = var5514d
Windows(dummy & ".xls").Activate
If Application.Cells(iRow, 3).Value = "9071" Then
var9071a = Application.Cells(iRow, 4).Value
var9071d = Application.Cells(iRow, 5).Value + Application.Cells(iRow, 6).Value
Windows("Ongoing Tracking - Dev.v3.xlsm").Activate
Application.Cells(iLine, 7).Value = var9071a
Application.Cells(iLine, 8).Value = var9071d
End If
Windows("Ongoing Tracking - Dev.v3.xlsm").Activate
Application.Cells(iLine, 7).Value = var9071a
Application.Cells(iLine, 8).Value = var9071d
Windows(dummy & ".xls").Activate
If Application.Cells(iRow, 3).Value = "9072" Then
var9072a = Application.Cells(iRow, 4).Value
var9072d = Application.Cells(iRow, 5).Value + Application.Cells(iRow, 6).Value
Windows("Ongoing Tracking - Dev.v3.xlsm").Activate
Application.Cells(iLine, 11).Value = var9072a
Application.Cells(iLine, 12).Value = var9072d
End If