LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default stuck at a loop

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


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
stuck in an error loop Darla Excel Discussion (Misc queries) 1 January 8th 10 06:06 PM
Stuck in a Sub Loop robzrob Excel Worksheet Functions 4 July 19th 08 11:53 PM
Stuck in endless loop, HELP! David Excel Programming 3 October 5th 07 05:35 PM
Stuck in a loop CWillis Excel Discussion (Misc queries) 2 June 5th 06 02:49 PM
HELP - Stuck in loop gti_jobert[_92_] Excel Programming 3 April 27th 06 01:41 PM


All times are GMT +1. The time now is 02:49 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"