Loop of Doom ARRRG!

  • Thread starter Thread starter jlclyde
  • Start date Start date
J

jlclyde

I was unable to make this loop work the way that I wanted to. TO make
it work I had to add a Goto. I hate these but find them necessary
when I get stuck in a loop. I was trying to find the last column in a
row that has information in it and then putting my information in the
next column. Any thoughts?
Thanks,
Jay
x = 12
Do
If Log.Cells(QuoteRow, x).Offset(0, 1) = "" Then
Log.Cells(QuoteRow, x).Offset(0, 1) = Dt
GoTo E
Else
x = x + 1
End If
Loop Until Log.Cells(QuoteRow, x) = ""

E:
 
try

Do Until Cells(QuoteRow, x) = ""
If Cells(QuoteRow, x).Offset(0, 1) = "" Then
Cells(QuoteRow, x).Offset(0, 1) = Dt
GoTo E
Else
x = x + 1
End If
Loop
 
Loop not needed:

Sub dural()
Dim QuoteRow As Long
QuoteRow = 13
n = Cells(QuoteRow, Columns.Count).End(xlToLeft).Column
Cells(QuoteRow, n + 1).Value = Cells(QuoteRow, n).Value
End Sub
 
One way:

Replace your entire code with

Log.Cells(QuoteRow, Columns.Count).End(xlToLeft)(1, 2).Value = Dt
 
Back
Top