PC Review


Reply
Thread Tools Rate Thread

Calculating Textboxes

 
 
ordnance1
Guest
Posts: n/a
 
      26th Oct 2009
I need something that will find the Max value found in Textbox21, TextBox31,
Textbox41 then multiply that number by 24 then subtracted the Min value of
Textbox22, TextBox32, Textbox42 multiplied by 24.

Ant textbox that is blank should be ignored.

 
Reply With Quote
 
 
 
 
Rick Rothstein
Guest
Posts: n/a
 
      26th Oct 2009
Something like his should work...

With WorksheetFunction
Answer = 24 * (.Max(Textbox21.Value, TextBox31.Value, Textbox41.Value) _
- .Min(Textbox22.Value, TextBox32.Value, Textbox42.Value))
End With


--
Rick (MVP - Excel)


"ordnance1" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I need something that will find the Max value found in Textbox21,
>TextBox31, Textbox41 then multiply that number by 24 then subtracted the
>Min value of Textbox22, TextBox32, Textbox42 multiplied by 24.
>
> Ant textbox that is blank should be ignored.


 
Reply With Quote
 
ordnance1
Guest
Posts: n/a
 
      26th Oct 2009
I should refine my question more.

I want this calculation to take place when I make a change to Textbox50 and
I want the resulting value to be placed in Textbox60

"Rick Rothstein" <(E-Mail Removed)> wrote in message
news:eu94f$(E-Mail Removed)...
> Something like his should work...
>
> With WorksheetFunction
> Answer = 24 * (.Max(Textbox21.Value, TextBox31.Value, Textbox41.Value) _
> - .Min(Textbox22.Value, TextBox32.Value, Textbox42.Value))
> End With
>
>
> --
> Rick (MVP - Excel)
>
>
> "ordnance1" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>>I need something that will find the Max value found in Textbox21,
>>TextBox31, Textbox41 then multiply that number by 24 then subtracted the
>>Min value of Textbox22, TextBox32, Textbox42 multiplied by 24.
>>
>> Ant textbox that is blank should be ignored.

>

 
Reply With Quote
 
Rick Rothstein
Guest
Posts: n/a
 
      26th Oct 2009
Then, instead of a variable named Answer, you would assign the same thing I
showed to the Value property of Textbox60...

With WorksheetFunction
Textbox60.Value = 24 * (.Max(Textbox21.Value, TextBox31.Value, _
Textbox41.Value) - .Min(Textbox22.Value, _
TextBox32.Value, Textbox42.Value))
End With

and, as for this code, you would put it in the Change event for Textbox50
(this presumes you are either using an ActiveX TextBox on a worksheet or
your TextBox is located on a UserForm).

--
Rick (MVP - Excel)


"ordnance1" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
>I should refine my question more.
>
> I want this calculation to take place when I make a change to Textbox50
> and I want the resulting value to be placed in Textbox60
>
> "Rick Rothstein" <(E-Mail Removed)> wrote in message
> news:eu94f$(E-Mail Removed)...
>> Something like his should work...
>>
>> With WorksheetFunction
>> Answer = 24 * (.Max(Textbox21.Value, TextBox31.Value, Textbox41.Value) _
>> - .Min(Textbox22.Value, TextBox32.Value, Textbox42.Value))
>> End With
>>
>>
>> --
>> Rick (MVP - Excel)
>>
>>
>> "ordnance1" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>>I need something that will find the Max value found in Textbox21,
>>>TextBox31, Textbox41 then multiply that number by 24 then subtracted the
>>>Min value of Textbox22, TextBox32, Textbox42 multiplied by 24.
>>>
>>> Ant textbox that is blank should be ignored.

>>


 
Reply With Quote
 
ordnance1
Guest
Posts: n/a
 
      26th Oct 2009
I get the following error msg:

Unable to get the Max property of the WorksheetFunction Class

All textboxes are located on the same UserForm.


"Rick Rothstein" <(E-Mail Removed)> wrote in message
news:#(E-Mail Removed)...
> Then, instead of a variable named Answer, you would assign the same thing
> I showed to the Value property of Textbox60...
>
> With WorksheetFunction
> Textbox60.Value = 24 * (.Max(Textbox21.Value, TextBox31.Value, _
> Textbox41.Value) - .Min(Textbox22.Value, _
> TextBox32.Value, Textbox42.Value))
> End With
>
> and, as for this code, you would put it in the Change event for Textbox50
> (this presumes you are either using an ActiveX TextBox on a worksheet or
> your TextBox is located on a UserForm).
>
> --
> Rick (MVP - Excel)
>
>
> "ordnance1" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
>>I should refine my question more.
>>
>> I want this calculation to take place when I make a change to Textbox50
>> and I want the resulting value to be placed in Textbox60
>>
>> "Rick Rothstein" <(E-Mail Removed)> wrote in message
>> news:eu94f$(E-Mail Removed)...
>>> Something like his should work...
>>>
>>> With WorksheetFunction
>>> Answer = 24 * (.Max(Textbox21.Value, TextBox31.Value, Textbox41.Value)
>>> _
>>> - .Min(Textbox22.Value, TextBox32.Value, Textbox42.Value))
>>> End With
>>>
>>>
>>> --
>>> Rick (MVP - Excel)
>>>
>>>
>>> "ordnance1" <(E-Mail Removed)> wrote in message
>>> news:(E-Mail Removed)...
>>>>I need something that will find the Max value found in Textbox21,
>>>>TextBox31, Textbox41 then multiply that number by 24 then subtracted the
>>>>Min value of Textbox22, TextBox32, Textbox42 multiplied by 24.
>>>>
>>>> Ant textbox that is blank should be ignored.
>>>

>

 
Reply With Quote
 
Rick Rothstein
Guest
Posts: n/a
 
      26th Oct 2009
The code was tested before I posted it and it worked for me. Perhaps you
have a Reference screwed up. Go into the VB editor and click
Tools/References on the menu bar... if any are marked as Missing (or perhaps
some other indicator of an error), then put a check mark in that item's
checkbox and then click OK.

--
Rick (MVP - Excel)


"ordnance1" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
>I get the following error msg:
>
> Unable to get the Max property of the WorksheetFunction Class
>
> All textboxes are located on the same UserForm.
>
>
> "Rick Rothstein" <(E-Mail Removed)> wrote in message
> news:#(E-Mail Removed)...
>> Then, instead of a variable named Answer, you would assign the same thing
>> I showed to the Value property of Textbox60...
>>
>> With WorksheetFunction
>> Textbox60.Value = 24 * (.Max(Textbox21.Value, TextBox31.Value, _
>> Textbox41.Value) - .Min(Textbox22.Value, _
>> TextBox32.Value, Textbox42.Value))
>> End With
>>
>> and, as for this code, you would put it in the Change event for Textbox50
>> (this presumes you are either using an ActiveX TextBox on a worksheet or
>> your TextBox is located on a UserForm).
>>
>> --
>> Rick (MVP - Excel)
>>
>>
>> "ordnance1" <(E-Mail Removed)> wrote in message
>> news:%(E-Mail Removed)...
>>>I should refine my question more.
>>>
>>> I want this calculation to take place when I make a change to Textbox50
>>> and I want the resulting value to be placed in Textbox60
>>>
>>> "Rick Rothstein" <(E-Mail Removed)> wrote in message
>>> news:eu94f$(E-Mail Removed)...
>>>> Something like his should work...
>>>>
>>>> With WorksheetFunction
>>>> Answer = 24 * (.Max(Textbox21.Value, TextBox31.Value, Textbox41.Value)
>>>> _
>>>> - .Min(Textbox22.Value, TextBox32.Value,
>>>> Textbox42.Value))
>>>> End With
>>>>
>>>>
>>>> --
>>>> Rick (MVP - Excel)
>>>>
>>>>
>>>> "ordnance1" <(E-Mail Removed)> wrote in message
>>>> news:(E-Mail Removed)...
>>>>>I need something that will find the Max value found in Textbox21,
>>>>>TextBox31, Textbox41 then multiply that number by 24 then subtracted
>>>>>the Min value of Textbox22, TextBox32, Textbox42 multiplied by 24.
>>>>>
>>>>> Ant textbox that is blank should be ignored.
>>>>

>>


 
Reply With Quote
 
ordnance1
Guest
Posts: n/a
 
      27th Oct 2009
Not sure what the problem was, but I placed the code at the top of the
change event an now all is well.

Just wondering, is there any way in the .Min(Textbox22.Value,
TextBox32.Value, Textbox42.Value) portion, to exclude TextBoxes that are
blank (zero value)?



"Rick Rothstein" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> The code was tested before I posted it and it worked for me. Perhaps you
> have a Reference screwed up. Go into the VB editor and click
> Tools/References on the menu bar... if any are marked as Missing (or
> perhaps some other indicator of an error), then put a check mark in that
> item's checkbox and then click OK.
>
> --
> Rick (MVP - Excel)
>
>
> "ordnance1" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
>>I get the following error msg:
>>
>> Unable to get the Max property of the WorksheetFunction Class
>>
>> All textboxes are located on the same UserForm.
>>
>>
>> "Rick Rothstein" <(E-Mail Removed)> wrote in message
>> news:#(E-Mail Removed)...
>>> Then, instead of a variable named Answer, you would assign the same
>>> thing I showed to the Value property of Textbox60...
>>>
>>> With WorksheetFunction
>>> Textbox60.Value = 24 * (.Max(Textbox21.Value, TextBox31.Value, _
>>> Textbox41.Value) - .Min(Textbox22.Value, _
>>> TextBox32.Value, Textbox42.Value))
>>> End With
>>>
>>> and, as for this code, you would put it in the Change event for
>>> Textbox50 (this presumes you are either using an ActiveX TextBox on a
>>> worksheet or your TextBox is located on a UserForm).
>>>
>>> --
>>> Rick (MVP - Excel)
>>>
>>>
>>> "ordnance1" <(E-Mail Removed)> wrote in message
>>> news:%(E-Mail Removed)...
>>>>I should refine my question more.
>>>>
>>>> I want this calculation to take place when I make a change to Textbox50
>>>> and I want the resulting value to be placed in Textbox60
>>>>
>>>> "Rick Rothstein" <(E-Mail Removed)> wrote in message
>>>> news:eu94f$(E-Mail Removed)...
>>>>> Something like his should work...
>>>>>
>>>>> With WorksheetFunction
>>>>> Answer = 24 * (.Max(Textbox21.Value, TextBox31.Value,
>>>>> Textbox41.Value) _
>>>>> - .Min(Textbox22.Value, TextBox32.Value,
>>>>> Textbox42.Value))
>>>>> End With
>>>>>
>>>>>
>>>>> --
>>>>> Rick (MVP - Excel)
>>>>>
>>>>>
>>>>> "ordnance1" <(E-Mail Removed)> wrote in message
>>>>> news:(E-Mail Removed)...
>>>>>>I need something that will find the Max value found in Textbox21,
>>>>>>TextBox31, Textbox41 then multiply that number by 24 then subtracted
>>>>>>the Min value of Textbox22, TextBox32, Textbox42 multiplied by 24.
>>>>>>
>>>>>> Ant textbox that is blank should be ignored.
>>>>>
>>>

>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Calculating TextBoxes Patrick C. Simonds Microsoft Excel Programming 2 10th Jan 2009 12:37 AM
calculating textboxes =?Utf-8?B?ZW55YXc=?= Microsoft Excel Programming 1 13th Jul 2006 03:03 PM
Calculating with textboxes.... Mark Rosenkrantz Microsoft Excel Programming 4 23rd Nov 2003 12:42 PM
Calculating with textboxes Mark Rosenkrantz Microsoft Excel Discussion 2 23rd Nov 2003 11:32 AM
Calculating with Textboxes ... Mark Rosenkrantz Microsoft Excel Misc 1 23rd Nov 2003 10:55 AM


Features
 

Advertising
 

Newsgroups
 


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