View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_5_] Bob Phillips[_5_] is offline
external usenet poster
 
Posts: 620
Default Assigning Selected Cells to Code

Glad you like it. Sorry I wasn't around to respond to the follow-up, but I
see old Tom nipped in there.

Regards

Bob

"JMay" wrote in message news:tvbSa.1930$If5.459@lakeread06...
Bob, this is great!! Your macro makes up for the shortcomings of the
AutoCalculate feature that is missing a much needed "difference"
tabulation...
On screen all too often I've had to design it with certain cells "IN THE
NEGATIVE" just so I could use the Auto-Calculate Sum to get a quick
"Difference".
Thanks a million..
JMay

"Bob Phillips" wrote in message
...
Try this macro

Sub Difference()
If Selection.Areas.Count 2 Then
MsgBox "Too many areas selected"
Else
MsgBox "Difference is " & Application.Sum(Selection.Areas(1)) -
Application.Sum(Selection.Areas(2))
End If
End Sub


--
HTH

-------

Bob Phillips
... looking out across Poole Harbour to the Purbecks


"JMay" wrote in message
news:TSaSa.1928$If5.1696@lakeread06...
I wish to onscreen (example only) select (highlight) say B5:B7, then

(with
control key down) then select C10:C11; then run a macro that will

produce
a
MsgBox with:

"The Difference is 1,234.50"

B5 = 1,111.00
B6 = 2,222.00
B7 = 3,333.00 where B5:B7 total 6,666,00

and
C10 = 2,500.00
C11 = 2,931.50 where C10:C11 totals 5,431.50

Any help appreciated,,