![]() |
VBA - Worksheet Subtraction
Group, On a worksheet I can subtract in cell =B2 - B1 in cell B3. How would I do the same operation in VBA? Tony -- ajocius ------------------------------------------------------------------------ ajocius's Profile: http://www.excelforum.com/member.php...o&userid=17695 View this thread: http://www.excelforum.com/showthread...hreadid=488576 |
VBA - Worksheet Subtraction
Tony
Somevalue=Range("B2").Value-Range("B1").Value This presumes the sheet is active (Else you'll need to define the worksheet before the Range object), you can then read Somevalue variable There are other ways to do this like writing a user defined function, but not knowing what you are trying to do with the value the above should give you a start -- HTH Nick Hodge Microsoft MVP - Excel Southampton, England www.nickhodge.co.uk HIS "ajocius" wrote in message ... Group, On a worksheet I can subtract in cell =B2 - B1 in cell B3. How would I do the same operation in VBA? Tony -- ajocius ------------------------------------------------------------------------ ajocius's Profile: http://www.excelforum.com/member.php...o&userid=17695 View this thread: http://www.excelforum.com/showthread...hreadid=488576 |
VBA - Worksheet Subtraction
Thank you for the help. This is what I needed to subtract two times to get the time-interval. Works like a champ. Thanx again. Tony -- ajocius ------------------------------------------------------------------------ ajocius's Profile: http://www.excelforum.com/member.php...o&userid=17695 View this thread: http://www.excelforum.com/showthread...hreadid=488576 |
All times are GMT +1. The time now is 05:23 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com