VBA run time error "13"

Ruairi

New Member
Joined
Apr 19, 2016
Messages
2
Hi,
New to using VBA and know little about it. Using it for an Engineering project to solve deep seated slope stability problems. When entering in the first 7 calculations VBA solves these correctly in a user form. But when I try to calculate the 8th formula (AVHS8) it gives me an error, witch is run time error "13" type mismatch. I am unsure what the problem is, the formulas work in excel perfectly. if anyone could help it would be much appreciated. The problem is below.

BES, AVHS, DTCP and OH are just numbers that are set and do not change


Private Sub Calculate_Click()
RAD = Sqr(DTCP ^ 2 + OH ^ 2)
BES = DTCP / 3
AVHS1 = (0)
AVHS2 = (Sqr(RAD ^ 2 - (DTCP - BES) ^ 2) - OH)
AVHS3 = (Sqr(RAD ^ 2 - (DTCP - BES - BES) ^ 2) - (OH) + (Tan(30 * 3.14 / 180) * BES))
AVHS4 = (Sqr(RAD ^ 2 - (DTCP - BES - BES - BES) ^ 2) - (OH) + (Tan(30 * 3.14 / 180) * BES * 2))
AVHS5 = (Sqr(RAD ^ 2 - (DTCP - BES - BES) ^ 2) - (OH) + (Tan(30 * 3.14 / 180) * BES * 3))
AVHS6 = (Sqr(RAD ^ 2 - (DTCP - BES) ^ 2) - (OH) + (Tan(30 * 3.14 / 180) * BES * 4))
AVHS7 = (Sqr(RAD ^ 2 - (DTCP) ^ 2) - (OH) + (Tan(30 * 3.14 / 180) * BES * 5))

VBA can solve all the above code. it cant solve the code below (AVHS8)


AVHS8 = (Sqr(RAD ^ 2 - (DTCP + BES) ^ 2) - (OH) + (Tan(30 * 3.14 / 180) * BES * 6))
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.

Forum statistics

Threads
1,214,999
Messages
6,122,645
Members
449,093
Latest member
Ahmad123098

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