Adding a Variable into Input Box Prompt

AliStott

New Member
Joined
Oct 11, 2006
Messages
14
Hi,

I am trying to create an input box that uses a variable in the prompt. The input box requests the charge rate for a contract that is not in the list. I already have the code, description and exchange information.

The code I have used is:

'If not found then add contract details to list and request currency and rate information

If ActiveCell.Value = "" Then
ActiveCell.Value = ContractCode
ActiveCell.Offset(0, 1).Value = Exchange
ActiveCell.Offset(0, 2).Value = ContractDesc

ExRequest = InputBox("Please enter the execution rate for " & ContractDesc&, "Execution Rate")
'if no response set rate to 0
If ExRequest = "" Then
ExMsg = MsgBox("No rate provided. Execution rate will default to 0!")
ExRate = 0
Else: ExRate = ExRequest
End If
ActiveCell.Offset(0, 4).Value = ExRate


Unfortunately, the code I used returns a compile error: "Type-declaration character does not match declared data type". I have declared the variable as a string using Dim ContractDesc As String, but that hasn't resolved the issue.

I'm sure its something simple and would appreciate any help.

Many Thanks
Ali.
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.

erik.van.geit

MrExcel MVP
Joined
Feb 1, 2003
Messages
17,832
Hi, AliStott,

remove the ampersand "&"
ContractDesc&

kind regards,
Erik

EDIT:
Welcome to the Board !!!!!
 

Watch MrExcel Video

Forum statistics

Threads
1,133,453
Messages
5,658,866
Members
418,473
Latest member
shaztastic73

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
Top