Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA code to calculate the difference between rows

Alan Beban,
Thanks for your help. I used your VBA code and it works.

THere is one major problem. The new range created "a6:d6"
in your reply is "frozen". It will not respond to any
changes made in the selection say A1:d2. This is a severe
limitation for my application, to be effective it has to
respond to changes.
Sorry to bother you again, I should have mentioned this
requirement initially.

Do you see any value in my original suggestion. ie
subtracting the first two cells and looping through the
collection. The worksheet is large and comprises about 60
columns.

My problem is I am not certain if this will work, and I
have trouble programming a loop structure

Thanks for your assistance, I look forward to hearing
from you

desmond
-----Original Message-----
E.g., =a2:d2-a1:d1 array entered into a 4-cell row.

If you really want VBA code

Range("a6:d6") = [a2:d2-a1:d1]

Or to put the results into an array instead of dumping

them onto the
worksheet

Dim arr()
arr = [a2:d2-a1:d1]

Alan Beban

Desmond wrote:
Hello,
I have two rows of numbers in cells. I need the VBA

code
that will subtract each cell value in one line from

the
cell in the same column in the other line.

I created a macro that subtracts the first cell and
copies across the row, but with the worksheet

protected
this does not work. I tried a recorded macro

subtracting
each cell separately, and this seems to work. So I
believe I need a loop structure, and I am having

trouble
with this.

Your assistance would be appreciated. I know little of
programming, so your help would be valuable

Thanks

desmond


.

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
Macro code to hide rows and not calculate hidden rows bradmcq Excel Discussion (Misc queries) 0 September 1st 09 12:38 AM
Calculate the difference between two times - getting '#VALUE!' err Louis de Pointe du Lac Excel Worksheet Functions 2 June 20th 07 10:18 PM
How do you calculate the difference between two values within a p. emlouise Excel Discussion (Misc queries) 2 December 10th 04 03:13 AM
VBA code to calculate the difference between rows Alan Beban[_3_] Excel Programming 0 July 28th 03 04:39 AM
VBA code to calculate the difference between rows John Green[_2_] Excel Programming 0 July 28th 03 03:29 AM


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