InputBox or...to allow nubers formulas and Ranges I mean "Type:=0+1+8"

  • Thread starter Thread starter Bero
  • Start date Start date
B

Bero

I Need One kind of InputBox or...

'I am Going to ask for a CHECK AMOUNT
'the User can chose betwen
'insert the amount in number
'I mean: = 150
'or CheckAmount = "=150"
'or CheckAmount = "=$C$6:$C$11"
'or CheckAmount = "=$C$6:$C$11"

CheckAmount = Application.InputBox _
(Prompt:=Chr(10) & "1) Select a Range and/or insert the Full Amount!",
_
Title:="http://www.developersdex.com", _
Default:="=" & Application.WorksheetFunction.Sum(Selection)) & Chr(10)
& Chr(10) ', Type:=1+8)

when the range is already selected this Works fine
because the input Box gives me the total Amount such as 150
because:
c6=30
c7=30
c8=30
c9=30
c10=30
c11=30
but if the selected cell is say A1 when the dialog box appears if I
select Range("C6:C11"), the checkAmount=30

is there a solution to allow one Input Box for numbers and Ranges

I mean Type=0+1+8


Many Thanks!!
 
Bero,

The Type constants in Application.InputBox are not combinable.
You can't specify a sum of them to allow multiple input formats.
Your best bet is to allow any input an manually parse the input
to ensure that it is a valid number or range.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top