Issues with Capcost (Mismatch Type, Run-time Error '13')

anonymity

New Member
Joined
Jan 28, 2024
Messages
7
Office Version
  1. 365
  2. 2016
Hi guys, im a chemical engineering student, currently doing a senior work project for my final year, so i decided to use the capcost excel by turton, obtained from the book of Analysis Synthesis and Design of Chemical Processes 5th Edition. However, when trying to input data for 'fan' unit, it gives me the Run-time error '13' , mismatch type. The code highlighted this line in the debuggin section:
1706432362754.png


grateful for any help, thank you in advance :))
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
What do you see in the immediate box if you add this code before the calculation line:

VBA Code:
Debug.Print "tbBaseCost", IsNumeric(fanForm.tbBaseCost), fanForm.tbBaseCost
Debug.Print "CEPCI", IsNumeric(Range("CEPCI")),Range("CEPCI")
 
Upvote 0
What do you see in the immediate box if you add this code before the calculation line:

VBA Code:
Debug.Print "tbBaseCost", IsNumeric(fanForm.tbBaseCost), fanForm.tbBaseCost
Debug.Print "CEPCI", IsNumeric(Range("CEPCI")),Range("CEPCI")
i put the code at the top, and run, but nothing come out in the immediate box ( i may be doing something wrong i think?)
1706443053818.png
 
Upvote 0
Can you confirm you are familiar with the immediate box and that it is visible ?
(Ctrl+G if it is not visible)

If you can't get the immediate box to show what is in the 2 values, what do you see when it errors out and you hover over Range("CEPCI") and then over fanForm.tbBaseCost.
If nothing is obvious please provide a picture of the cell CEPCI showing the Cell & the formula bar & then Name box in the top left corner.
 
Upvote 0
sorry didnt realize i need to reload the debugging, and yes the immediate box now showing these: (value is the same as when i hover on both Range("CEPCI") and fanForm.tbBaseCost.
1706443887977.png
 
Upvote 0
So your issue is with fanForm.tbBaseCost, is that manually entered ?
There seems to be an additional space after the comma.
Ideally you want to address that at the source.
To address it in the code you could test that is numeric with an If IsNumeric line.
For the specific issue of an additional space your could try:

Rich (BB code):
iTemp = roundAmount(Replace(fanForm.tbBaseCost, " ","") / 397 * Range("CEPCE")
 
Upvote 0
1706446577590.png
1706446622667.png


the value for fanForm.tbBaseCost is automatically calculated when i input other required informations, for the code that you gave me, it comes off with this problem.
 
Upvote 0
I seem to have missed a closing parenthesis. Add ")" at the end. Without the quotes.
PS I have logged off for the night
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,179
Members
453,021
Latest member
Justyna P

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