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

The range references below will all refer to the active sheet.

Alan Beban

Alan Beban wrote:
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 difference in dates Geo Excel Discussion (Misc queries) 11 August 12th 08 07:18 AM
calculate the difference between two cells jrivel Excel Discussion (Misc queries) 2 October 31st 06 02:08 PM
How can I calculate the difference between times without using th. KELSEY1022 Excel Worksheet Functions 12 February 2nd 05 05:06 PM
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 10:02 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"