Worksheet function question

Tony Miall

Active Member
Joined
Oct 16, 2007
Messages
304
Hi,

I am just starting out with these and cant work out why the following wont work

Code:
Private Sub Brk3825Qty_AfterUpdate()
Dim Tek As Integer
Tek = WorksheetFunction.Sum((FlatTop.Brk3825Qty.Value * 3), (FlatTop.BrkLQty.Value * 2))
FlatTop.Tek1016Qty.Value = Tek
End Sub

I am getting a "Type mis match" error.

Thanks
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Hi,

I am just starting out with these and cant work out why the following wont work

Code:
Private Sub Brk3825Qty_AfterUpdate()
Dim Tek As Integer
Tek = WorksheetFunction.Sum((FlatTop.Brk3825Qty.Value * 3), (FlatTop.BrkLQty.Value * 2))
FlatTop.Tek1016Qty.Value = Tek
End Sub

I am getting a "Type mis match" error.

Thanks

you have to dim flatTop as a worksheet and Brk3825Qty as a range

something like
dim Brk3825Qty as range
dim flatTop as worksheet

then assign a sheet to flatTop and a cell to Brk3825Qty
something like

set Brk3825Qty=activesheet.range("a1")
set flatTop= activesheet

even then you will use only Brk3825Qty and not flatTop.Brk3825Qty in your formula
 
Upvote 0
Hi Tony,

As an interger can only hold whole numbers in the range -32,768 to 32,767, also check what the answer (i.e. the amount trying to be assigned to the variable) is, for if it's outside this range you'll need to change it to another variable type (i.e. double).

HTH

Robert
 
Last edited:
Upvote 0
Thanks for the replies.

Trebor, I changed from Integer to Double and still no luck.


Arul.rajesh, to clarify...

"FlatTop" is a User Form and "Brk3825Qty" is a text box on the the user Form.
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,275
Members
452,902
Latest member
Knuddeluff

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top