Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro code to hide rows and not calculate hidden rows | Excel Discussion (Misc queries) | |||
Calculate the difference between two times - getting '#VALUE!' err | Excel Worksheet Functions | |||
How do you calculate the difference between two values within a p. | Excel Discussion (Misc queries) | |||
VBA code to calculate the difference between rows | Excel Programming | |||
VBA code to calculate the difference between rows | Excel Programming |