954,535 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

A new question about adding and subtracting

First of all let me say I love this forum, everyone has been very nice and extremely helpful! Now to my question.

I got help with a question like this before and the answer I got worked perfectly. However I have a new angle. I'm wanting to take and subtract from a caption but after a random number has been chosen. Thus lets say at the click of a button a random number of 6 is picked. I want that to be subtracted from a caption that is set at 100. Thanks in advance for all the help!

venomocity
Newbie Poster
16 posts since Aug 2007
Reputation Points: 2
Solved Threads: 0
 

Not sure understood your question, do you want to for ex subtract the number entered in label2 from label1 ? If so do the following
If IsNumeric(Me.Label1.Caption) Then
if IsNumeric(Me.Label2.Caption) then
Me.Label1.Caption = Me.Label1.Caption - Me.Label2.Caption
end if
end if

Or do you want to prompt the user for a number? Then use Inputbox

plusplus
Posting Whiz in Training
207 posts since Jul 2007
Reputation Points: 10
Solved Threads: 16
 

Hi,

use this:
I assume u know how to generate Random Number and is stored in RndVar. If u dont know, i will give u the code...

Dim TLng As Long
TLng = Val(Label1.Caption) - RndVar
Msgbox "Result Is " & TLng


Regards
Veena

QVeen72
Posting Shark
950 posts since Nov 2006
Reputation Points: 84
Solved Threads: 143
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You