Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Newbie. Please help me find a loop solution

I am trying to calculate a value for a cell and at the same time store
the previous cell value for the next calculation. The following code
works, but
I need to find a way to loop this until column AN and row 3000. I know
there must be a better solution than how my code works and would be
very greatful if someone can point me in the right direction.

Sub test()
Dim temp As Single
Dim temp2 As Single

temp = Range("m2").Value
Range("m2").Value = Range("j2").Value - temp
temp2 = Range("n2").Value
Range("n2").Value = temp - temp2
temp = Range("o2").Value
Range("o2").Value = temp2 - temp
temp2 = Range("p2").Value
Range("p2").Value = temp2 - temp

End Sub

I know there must be a better solution than how my code works and
would be very greatful if someone can point me in the right direction.

Nigel Brown
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
Getting #DIV/O. Can't find a solution Dobbin0_4[_2_] Excel Discussion (Misc queries) 4 September 12th 08 10:44 PM
sum if problem, trying to find best solution shalombi Excel Discussion (Misc queries) 5 May 31st 06 12:57 PM
please find a solution somaraju Excel Discussion (Misc queries) 1 March 16th 06 10:40 AM
VBA Newbie: Help with Do Loop code Carl Excel Discussion (Misc queries) 3 December 2nd 04 08:04 PM


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