SysAdminMike
IS-IT--Management
I have a macro I wrote to sort through some data I have (see below)
Everything worked perfectly UNTIL I added
at the end. Any ideas?
Thanks,
Michael
Code:
Sub FreeGVMCounter()
Dim s1 As Worksheet
Dim s2 As Worksheet
Dim row, host, count, total As Integer
Set s1 = ActiveWorkbook.ActiveSheet
Set s2 = ActiveWorkbook.Sheets("Overview")
For i = 2 To 600 Step 1
host = 0
count = 0
Do While s1.Cells(i + host, 1) <> ""
If s1.Cells(i + host, 4) = "gvm-free" Then
count = count + 1
End If
host = host + 1
Loop
If host <> 0 Then
s1.Cells(i + host, 4) = "Available GVMs"
s1.Cells(i + host, 5) = count
i = i + host
End If
Next i
If s1 = ActiveWorkbook.Sheets("Loc1") Then
s2.Cells(4, 5) = total
ElseIf ActiveWorkbook.Sheets("Loc2") Then
s2.Cells(5, 5) = total
End If
End Sub
Everything worked perfectly UNTIL I added
Code:
If s1 = ActiveWorkbook.Sheets("Loc1") Then
s2.Cells(4, 5) = total
ElseIf ActiveWorkbook.Sheets("Loc2") Then
s2.Cells(5, 5) = total
End If
at the end. Any ideas?
Thanks,
Michael