VBA InputBox Percentage problem

reekome

New Member
Joined
Apr 24, 2011
Messages
2
Every time I try to input a number through the input box and into a cell, it converts to a full percentage. That cell is formatted to "Percentage" anyway. But I need it to function normally. For example, If I put 20 in the InputBox, I want it to show as 20% in the cell, and not as 200% here is the code I am using..


Range("C5").Select
Range("B3").Value = InputBox("What is the Property Postcode?")
Range("B4").Value = InputBox("What is the Purchase Price?")
Range("B5").Value = InputBox("What is the Deposit?")
Range("B7").Value = InputBox("What is the Interest Rate?")
Range("B8").Value = InputBox("What is the Terms In years?")
Range("B9").Select

I need cell B7 to show what I insert in the InputBox and not multiply it by 100

Thanks!
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
You need to respond to the Inputbox with .20 or 0.20
 
Upvote 0
I think you have to divide what you enter by 100. So the 20% would actually be a value of 0.2

So this should work.

Code:
Range("C5").Select
    Range("B3").Value = InputBox("What is the Property Postcode?")
    Range("B4").Value = InputBox("What is the Purchase Price?")
    Range("B5").Value = InputBox("What is the Deposit?")
    Range("B7").Value = (InputBox("What is the Interest Rate?") / 100)
    Range("B8").Value = InputBox("What is the Terms In years?")
    Range("B9").Select
 
Upvote 0
Addition - or use:

Code:
[B7* = InputBox("What is the Interest Rate?")/100
 
Upvote 0
I think you have to divide what you enter by 100. So the 20% would actually be a value of 0.2

So this should work.

Code:
Range("C5").Select
    Range("B3").Value = InputBox("What is the Property Postcode?")
    Range("B4").Value = InputBox("What is the Purchase Price?")
    Range("B5").Value = InputBox("What is the Deposit?")
    Range("B7").Value = (InputBox("What is the Interest Rate?") / 100)
    Range("B8").Value = InputBox("What is the Terms In years?")
    Range("B9").Select

Thank you so much! I've been searching high and low for a solution.. this worked perfectly :D
 
Upvote 0
Addition - or use:

Code:
[B7* = InputBox("What is the Interest Rate?")/100

Type: This should have been

Code:
[B7] = InputBox("What is the Interest Rate?")/100
 
Upvote 0

Forum statistics

Threads
1,224,603
Messages
6,179,850
Members
452,948
Latest member
UsmanAli786

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