Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default incrementing cells withina formula in VB

Hi,


Do While Range("b11").Value 0
Range("e15").Value = Range("e15").Value + Range("c15").Value
Range("e16").Value = Range("e16").Value + Range("c16").Value
Range("e17").Value = Range("e17").Value + Range("c17").Value
.........
Range("e40").Value = Range("e40").Value + Range("c40").Value
Range("b11").Value = Range("b11").Value - 1
End

Loop

Any help appreciated. I'm trying to get a spreadsheet to check a list
of values if a condition is met. For example, B11 = 40 in this
instance. While this works as is, i would like to clean it up by
perhaps having a single line formula that would increment the row
values as it goes through the loop. along the lines of:

Range("b12").Value = "55"
Do While Range("b11").Value 0
Range("b12").Value = Range("b12").Value - Range("b11").Value
Range("e[B11]").Value = Range("e[B11]").Value +
Range("c[B11]").").Value
Range("b11").Value = Range("b11").Value - 1
End

Loop
Thanks

Paul
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default incrementing cells withina formula in VB

Hi Paul
not compelte sure but try
sub foo()
dim row_index as long
dim lastrow as long
with activesheet
lastrow=.range("B11").value
for row_index = lastrow to 1 step -1
.cells(row_index,"E").value=.cells(row_index,"E"). value + _
.cells(row_index,"C").value
next
end with
end sub



--
Regards
Frank Kabel
Frankfurt, Germany


Paul wrote:
Hi,


Do While Range("b11").Value 0
Range("e15").Value = Range("e15").Value + Range("c15").Value
Range("e16").Value = Range("e16").Value + Range("c16").Value
Range("e17").Value = Range("e17").Value + Range("c17").Value
........
Range("e40").Value = Range("e40").Value + Range("c40").Value
Range("b11").Value = Range("b11").Value - 1
End

Loop

Any help appreciated. I'm trying to get a spreadsheet to check a list
of values if a condition is met. For example, B11 = 40 in this
instance. While this works as is, i would like to clean it up by
perhaps having a single line formula that would increment the row
values as it goes through the loop. along the lines of:

Range("b12").Value = "55"
Do While Range("b11").Value 0
Range("b12").Value = Range("b12").Value - Range("b11").Value
Range("e[B11]").Value = Range("e[B11]").Value +
Range("c[B11]").").Value
Range("b11").Value = Range("b11").Value - 1
End

Loop
Thanks

Paul


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
Incrementing numbers in cells Andrew Morine Excel Worksheet Functions 1 August 26th 08 02:11 AM
how do I disable the option that keeps incrementing cells by 1? Excel-novice Excel Worksheet Functions 1 October 14th 06 05:21 PM
incrementing with blank cells in between alexmace Excel Discussion (Misc queries) 2 March 9th 06 11:34 PM
Newbie needs help with incrementing a series of cells mikeod Excel Worksheet Functions 5 November 16th 05 08:19 PM
how to format only a specific character or number in each cell withina range of cells Colleen Excel Worksheet Functions 1 September 12th 05 05:44 PM


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