Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default "Loop until" syntax question


Hi,
I am after help for the following:

Range("TotalCentralregion").Select ' Range is a single cell
Selection.Offset(1, 0).Select
Selection.Formula = "=(" & ActiveCell.Offset(0, -2).Address & "
/EastTotal)"

What I need to do is loop this formula down a column until it gets to a
single cell that has been named "TotalEastRegion". (Formula has to
include "TotaleastRegion).

Thanks for the help in advance.

Fastbike


--
Fastbike
------------------------------------------------------------------------
Fastbike's Profile: http://www.excelforum.com/member.php...o&userid=26701
View this thread: http://www.excelforum.com/showthread...hreadid=401530

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default "Loop until" syntax question

This really isn't a need to do any looping (or selecting):

Sub demo()
With Range(Range("TotalCentralRegion").Offset(1), "TotalEastRegion")
.FormulaR1C1 = "=RC[-2]/EastTotal"
End With
End Sub

--
Jim
"Fastbike" wrote in
message ...

Hi,
I am after help for the following:

Range("TotalCentralregion").Select ' Range is a single cell
Selection.Offset(1, 0).Select
Selection.Formula = "=(" & ActiveCell.Offset(0, -2).Address & "
/EastTotal)"

What I need to do is loop this formula down a column until it gets to a
single cell that has been named "TotalEastRegion". (Formula has to
include "TotaleastRegion).

Thanks for the help in advance.

Fastbike


--
Fastbike
------------------------------------------------------------------------
Fastbike's Profile:
http://www.excelforum.com/member.php...o&userid=26701
View this thread: http://www.excelforum.com/showthread...hreadid=401530



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default "Loop until" syntax question

The easiest way is to create a Range which is all of the cells between the
two named ranges and then ust traverse those cells... Kind of like this

dim rngToSearch as Range
dim rngCurrent as range

set rngToSearch = range(Range("TotalCentralregion"), Range("TotalEastregion"))
for each rngCurrent in rngToSearch
'rngCurrent is just like the active cell
rngCurrent.Formula = "=(" & rngCurrent.Offset(0, -2).Address & "/EastTotal)"

next rngCurrent
--
HTH...

Jim Thomlinson


"Fastbike" wrote:


Hi,
I am after help for the following:

Range("TotalCentralregion").Select ' Range is a single cell
Selection.Offset(1, 0).Select
Selection.Formula = "=(" & ActiveCell.Offset(0, -2).Address & "
/EastTotal)"

What I need to do is loop this formula down a column until it gets to a
single cell that has been named "TotalEastRegion". (Formula has to
include "TotaleastRegion).

Thanks for the help in advance.

Fastbike


--
Fastbike
------------------------------------------------------------------------
Fastbike's Profile: http://www.excelforum.com/member.php...o&userid=26701
View this thread: http://www.excelforum.com/showthread...hreadid=401530


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default "Loop until" syntax question


Range("TotalCentralregion").select
Do
Selection.(1, 0).Formula = "=(" & ActiveCell.Offset(0, -2).Address &
"/EastTotal)"
ACtivecell.Offset(1.0).select
Loop Until Activecell.value like "*TotalEastRegion*"

--

HTH

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


"Fastbike" wrote in
message ...

Hi,
I am after help for the following:

Range("TotalCentralregion").Select ' Range is a single cell
Selection.Offset(1, 0).Select
Selection.Formula = "=(" & ActiveCell.Offset(0, -2).Address & "
/EastTotal)"

What I need to do is loop this formula down a column until it gets to a
single cell that has been named "TotalEastRegion". (Formula has to
include "TotaleastRegion).

Thanks for the help in advance.

Fastbike


--
Fastbike
------------------------------------------------------------------------
Fastbike's Profile:

http://www.excelforum.com/member.php...o&userid=26701
View this thread: http://www.excelforum.com/showthread...hreadid=401530



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default "Loop until" syntax question


Hi,
thanks for all the replies. Much appreciated.


--
Fastbike
------------------------------------------------------------------------
Fastbike's Profile: http://www.excelforum.com/member.php...o&userid=26701
View this thread: http://www.excelforum.com/showthread...hreadid=401530

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
correct syntax for nesting "if", "and", and "vlookup"....if possib Christine Excel Worksheet Functions 4 January 2nd 09 10:43 PM
"Disk is Full" add-on question to "Can't reset last cell" post tod [email protected] Excel Discussion (Misc queries) 0 January 22nd 07 02:32 AM
Syntax to "OR" 3 "ISERROR" conditions Mike K Excel Worksheet Functions 6 July 22nd 06 04:18 PM
disregard 12/19/05 ".XValues syntax problem" question. Answer fou JF_01 Charts and Charting in Excel 1 December 19th 05 08:22 PM
what is syntax for if(between range of dates,"Q1","Q2")? TLB Excel Worksheet Functions 3 December 6th 05 05:19 PM


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