Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default Loop Function unable to loop

Hi,

I am doing a macro that uses Do Until...Loop to process on certain column
data(Col G) and go thru row by row on my wksheet and print that
string(Print#2) onto a script txt file.

The problem is i am always stuck at row 1 and does not automatically go to
the next row of data. CAn anyone advise why is this so and how to?

My Example:

Sub test( )
Do Until ActiveCell.Row LastRow

ActiveCell.FormulaR1C1 = Range("G2")
Total$ = ActiveCell.FormulaR1C1

If ActiveCell.FormulaR1C1 = "" Then GoTo Skiptohere

Print #2, "testing"
Print #2, "testing"
Print #2, "testing"

Skiptohe
Print #2, " #End script file"
Close #2

ActiveCell.Offset(1, 0).Range("A7").Select
Loop
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Loop Function unable to loop

Not sure what you are trying to do but I have revamped so

Sub test()
LastRow = 7
For i = ActiveCell.Row To LastRow

Cells(i, ActiveCell.Column).FormulaR1C1 = Range("G2")
Total$ = Cells(i, ActiveCell.Column).FormulaR1C1

If Cells(i, ActiveCell.Column).Value = "" Then GoTo Skiptohere

Print #2, "testing"
Print #2, "testing"
Print #2, "testing"

Skiptohe
Print #2, " #End script file"
Close #2

Next i
End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Junior728" wrote in message
...
Hi,

I am doing a macro that uses Do Until...Loop to process on certain column
data(Col G) and go thru row by row on my wksheet and print that
string(Print#2) onto a script txt file.

The problem is i am always stuck at row 1 and does not automatically go to
the next row of data. CAn anyone advise why is this so and how to?

My Example:

Sub test( )
Do Until ActiveCell.Row LastRow

ActiveCell.FormulaR1C1 = Range("G2")
Total$ = ActiveCell.FormulaR1C1

If ActiveCell.FormulaR1C1 = "" Then GoTo Skiptohere

Print #2, "testing"
Print #2, "testing"
Print #2, "testing"

Skiptohe
Print #2, " #End script file"
Close #2

ActiveCell.Offset(1, 0).Range("A7").Select
Loop
End Sub



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
Find loop doesn't loop JSnow Excel Discussion (Misc queries) 2 June 24th 09 08:28 PM
Does loop function cause this problem? Eric Excel Worksheet Functions 3 July 1st 07 01:40 PM
Problem adding charts using Do-Loop Until loop Chris Bromley[_2_] Excel Programming 2 May 23rd 05 01:31 PM
Need function for checkbox in loop Matt Excel Programming 7 January 14th 04 03:29 AM
HELP!!!! Can't stop a loop (NOT an infinite loop) TBA[_2_] Excel Programming 3 December 14th 03 03:33 PM


All times are GMT +1. The time now is 01:28 AM.

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

About Us

"It's about Microsoft Excel"