Runtime error "6" Overflow

crimzon

New Member
Joined
Feb 28, 2014
Messages
6
Hi guys
i am new to the VB and i need your help to sort out the below problem

Im using below simple code by passing these values 898098878(param1) 7768978989(param2) and unfortunately getting the this error RUNTIME ERROR "6" Overflow.


Private Sub CommandButton5_Click()
Dim param1 As Long
Dim param2 As Long

param1 = gross.Text
param2 = eprem.Text

TextBox2 = Format((param1& / param2&), "0.00%")
TextBox1 = param1& + param2&

End Sub
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
A Long is a 32-bit integer. Those values are too large in a Long. You could declare the variables as Double if you need to use a numeric variable, or as String if they can be text.
 
Upvote 0
A Long is a 32-bit integer. Those values are too large in a Long. You could declare the variables as Double if you need to use a numeric variable, or as String if they can be text.

Thank you very much for your kind reply.
it works fine.
 
Upvote 0

Forum statistics

Threads
1,215,410
Messages
6,124,749
Members
449,186
Latest member
HBryant

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