#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 410
Default Loop of Doom ARRRG!

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:
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 896
Default Loop of Doom ARRRG!

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
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Loop of Doom ARRRG!

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

--
Gary''s Student - gsnu200819
  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4,624
Default Loop of Doom ARRRG!

One way:

Replace your entire code with

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

In article
,
jlclyde wrote:

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?

Reply
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
do..loop Anna Excel Discussion (Misc queries) 6 June 20th 07 01:10 PM
DO LOOP in VBA Brettjg Excel Discussion (Misc queries) 5 April 24th 07 12:42 AM
Do Loop BobBarker Excel Worksheet Functions 0 August 19th 05 08:44 PM
Do Loop BobBarker Excel Worksheet Functions 0 August 19th 05 07:45 PM
Do Loop BobBarker Excel Worksheet Functions 0 August 19th 05 06:54 PM


All times are GMT +1. The time now is 09:40 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"