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 - 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,173
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

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
subtraction Mark Excel Discussion (Misc queries) 2 August 12th 09 07:31 AM
subtraction Nish Excel Discussion (Misc queries) 3 April 6th 09 07:50 PM
Subtraction Rookie Excel Worksheet Functions 14 February 24th 08 11:42 AM
subtraction with dates Juco Excel Worksheet Functions 7 March 7th 05 10:34 PM
subtraction derekc Excel Programming 5 April 30th 04 06:12 PM


All times are GMT +1. The time now is 10:58 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"