Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 13
Default Syntax for stopping a Do Loop?

I have columns of data and recorded a macro for taking the average of every
seven numerical entries. What syntax do I use to tell the macro to stop
looping when it gets to a blank cell in the column?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default Syntax for stopping a Do Loop?

Hi,

Post your recorded macro.
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"bondjel" wrote:

I have columns of data and recorded a macro for taking the average of every
seven numerical entries. What syntax do I use to tell the macro to stop
looping when it gets to a blank cell in the column?

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,646
Default Syntax for stopping a Do Loop?

See Exit Do statement in Do ...Loop in VBA Help!

--
Regards!
Stefi



€˛bondjel€¯ ezt Ć*rta:

I have columns of data and recorded a macro for taking the average of every
seven numerical entries. What syntax do I use to tell the macro to stop
looping when it gets to a blank cell in the column?

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 13
Default Syntax for stopping a Do Loop?

Mike,

Here it is:


Do
ActiveCell.FormulaR1C1 = "=AVERAGE(R[-6]C[-1]:RC[-1])"
ActiveCell.Offset(7, 0).Range("A1").Select
ActiveCell.FormulaR1C1 = "=AVERAGE(R[-6]C[-1]:RC[-1])"
Loop

"Mike H" wrote:

Hi,

Post your recorded macro.
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"bondjel" wrote:

I have columns of data and recorded a macro for taking the average of every
seven numerical entries. What syntax do I use to tell the macro to stop
looping when it gets to a blank cell in the column?

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default Syntax for stopping a Do Loop?

Hi,

there will no doubt be some comment that selecting cells isn't the best way
to do what you want but if it works for you then so be it. This selects the
cell then checks for data in the cell to the left and if it's empty the loop
terminates

Do
ActiveCell.FormulaR1C1 = "=AVERAGE(R[-6]C[-1]:RC[-1])"
ActiveCell.Offset(7, 0).Range("A1").Select
Loop Until ActiveCell.Offset(, -1).Value = ""
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"bondjel" wrote:

Mike,

Here it is:


Do
ActiveCell.FormulaR1C1 = "=AVERAGE(R[-6]C[-1]:RC[-1])"
ActiveCell.Offset(7, 0).Range("A1").Select
ActiveCell.FormulaR1C1 = "=AVERAGE(R[-6]C[-1]:RC[-1])"
Loop

"Mike H" wrote:

Hi,

Post your recorded macro.
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"bondjel" wrote:

I have columns of data and recorded a macro for taking the average of every
seven numerical entries. What syntax do I use to tell the macro to stop
looping when it gets to a blank cell in the column?



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 13
Default Syntax for stopping a Do Loop?

Mike,

I only suggested using the blank cell because in my relative ignorance I
thought it would be easiest. But I think your suggested solution worked.
Thanks again.

Jim

"Mike H" wrote:

Hi,

there will no doubt be some comment that selecting cells isn't the best way
to do what you want but if it works for you then so be it. This selects the
cell then checks for data in the cell to the left and if it's empty the loop
terminates

Do
ActiveCell.FormulaR1C1 = "=AVERAGE(R[-6]C[-1]:RC[-1])"
ActiveCell.Offset(7, 0).Range("A1").Select
Loop Until ActiveCell.Offset(, -1).Value = ""
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"bondjel" wrote:

Mike,

Here it is:


Do
ActiveCell.FormulaR1C1 = "=AVERAGE(R[-6]C[-1]:RC[-1])"
ActiveCell.Offset(7, 0).Range("A1").Select
ActiveCell.FormulaR1C1 = "=AVERAGE(R[-6]C[-1]:RC[-1])"
Loop

"Mike H" wrote:

Hi,

Post your recorded macro.
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"bondjel" wrote:

I have columns of data and recorded a macro for taking the average of every
seven numerical entries. What syntax do I use to tell the macro to stop
looping when it gets to a blank cell in the column?

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
Stopping an Entry Ed O'Brien Excel Discussion (Misc queries) 12 October 2nd 09 08:47 AM
Find loop doesn't loop JSnow Excel Discussion (Misc queries) 2 June 24th 09 08:28 PM
Stopping a CountIf Don Kline[_2_] Excel Worksheet Functions 5 May 22nd 09 04:39 PM
Stopping a formula Roachy Excel Discussion (Misc queries) 3 July 1st 08 03:31 PM
Stopping Calculation Kelly Excel Discussion (Misc queries) 2 March 15th 06 10:56 PM


All times are GMT +1. The time now is 10:57 PM.

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"