C
computers hate me
Ok so i wrote a macro that compares a list of alarms from sheet 1 on column
d and compares it to a list of "master alarms" in sheet 2 in column a.
If there an alarm found in the first sheet comlumn d but its not in the
"master alarms" then it pasts this alarm at the end of the "master alarms"
list.
But my macro seems to get stuck in sheet 1 cell( D9). it just keeps coping
the same cell over and over again to the end of my "master alarms" and it
never stops i dont knwo why
here is the macro
Public row1, row2 As Integer
Public row3 As Integer
Public alarm1, alarm2 As String
Sub Alarms()
row1 = 8
row2 = 1
row3 = 1
Do Until Sheets("Data 14").Cells(row1, 4) = ""
Do Until Sheets("Identified Bf 14 alarms").Cells(row2, 1) = ""
Sheets("Data 14").Select
alarm1 = Cells(row1, 14)
alarm2 = Sheets("Identified Bf 14 alarms").Cells(row2, 1)
If alarm1 <> alarm2 Then
row2 = row2 + 1
If Cells(row2, 1) = "" Then
Sheets("Data 14").Select
Cells(row1, 14).Select
Selection.Copy
Sheets("Identified Bf 14 alarms").Select
FindEmptyRow
Cells(row3, 1).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Sheets("Data 14").Select
Cells(row1, 4).Select
Selection.Copy
Sheets("Identified Bf 14 alarms").Select
FindEmptyRow
Cells(row3, 2).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Else: row1 = row1 + 1
End If
End If
Loop
Loop
End Sub
d and compares it to a list of "master alarms" in sheet 2 in column a.
If there an alarm found in the first sheet comlumn d but its not in the
"master alarms" then it pasts this alarm at the end of the "master alarms"
list.
But my macro seems to get stuck in sheet 1 cell( D9). it just keeps coping
the same cell over and over again to the end of my "master alarms" and it
never stops i dont knwo why
here is the macro
Public row1, row2 As Integer
Public row3 As Integer
Public alarm1, alarm2 As String
Sub Alarms()
row1 = 8
row2 = 1
row3 = 1
Do Until Sheets("Data 14").Cells(row1, 4) = ""
Do Until Sheets("Identified Bf 14 alarms").Cells(row2, 1) = ""
Sheets("Data 14").Select
alarm1 = Cells(row1, 14)
alarm2 = Sheets("Identified Bf 14 alarms").Cells(row2, 1)
If alarm1 <> alarm2 Then
row2 = row2 + 1
If Cells(row2, 1) = "" Then
Sheets("Data 14").Select
Cells(row1, 14).Select
Selection.Copy
Sheets("Identified Bf 14 alarms").Select
FindEmptyRow
Cells(row3, 1).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Sheets("Data 14").Select
Cells(row1, 4).Select
Selection.Copy
Sheets("Identified Bf 14 alarms").Select
FindEmptyRow
Cells(row3, 2).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Else: row1 = row1 + 1
End If
End If
Loop
Loop
End Sub