Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default InputBox default value?

Hi, I'd like to make an input box pop up with a default value on it,
that should be stored in a variable, and that any information on this
would then be inserted on a cell like an excel formula.
Questions a
1. How to make an inputbox pop up with a default value?
2. How to insert a formula on a cell like it was inserted in excel and
not vba?
VBA Style: ActiveCell.FormulaR1C1 = _
"=IF(PedidosImp!RC[-29]="""",REPT(""
"",25),TEXT(PedidosImp!RC[-26],""0000000,00""))"
I'd like to insert a formula like:
=IF(PedidosImp!F1="";REPT(" ";25);TEXT(PedidosImp!I1;"0000000,00"))

Without that extra quoting.

Thanks in advance!

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default InputBox default value?

Lunks,

1:

Dim myVal As Variant
myVal = Application.InputBox("Enter a value", _
"My Input", "Default Value")
MsgBox myVal


2:

You need the doubled-up double quotes to tell Excel that they are to be put into the formula. No
way around it.

HTH,
Bernie
MS Excel MVP


"Lunks" wrote in message
oups.com...
Hi, I'd like to make an input box pop up with a default value on it,
that should be stored in a variable, and that any information on this
would then be inserted on a cell like an excel formula.
Questions a
1. How to make an inputbox pop up with a default value?
2. How to insert a formula on a cell like it was inserted in excel and
not vba?
VBA Style: ActiveCell.FormulaR1C1 = _
"=IF(PedidosImp!RC[-29]="""",REPT(""
"",25),TEXT(PedidosImp!RC[-26],""0000000,00""))"
I'd like to insert a formula like:
=IF(PedidosImp!F1="";REPT(" ";25);TEXT(PedidosImp!I1;"0000000,00"))

Without that extra quoting.

Thanks in advance!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default InputBox default value?

I'm getting "Compile Error: Expected: list separator or )"
With the following formula:
UF = InputBox("Aperte Enter.","
","=IF(PedidosImp!RC[-20]="""",IF(PedidosImp!RC[-11]=""ML"",""MIL"" &
REPT("" "",2),IF(PedidosImp!RC[-11]=""PT"",""PK"" & REPT(""
"",3),IF(PedidosImp!RC[-11]=""CL"",""CT"" & REPT(""
"",3),IF(PedidosImp!RC[-11]=""LT"",""L"" & REPT(""
"",4),IF(PedidosImp!RC[-11]=""PR"",""PAR"" & REPT(""
"",2),IF(PedidosImp!RC[-11]=""MT"",""M"" & REPT(""
"",4),PedidosImp!RC[-11] _
&REPT("" "",5-LEN(PedidosImp!RC[-11])))))),REPT("" "",10))"

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default InputBox default value?

Lunks,

Your formula is too long - Inputboxes are limited to 255 characters:

Dim myStr As String
Dim UF As String
myStr = "=IF(PedidosImp!RC[-20]="""",IF(PedidosImp!RC[-11]=""ML"",""MIL"" & " & _
"REPT("" "",2),IF(PedidosImp!RC[-11]=""PT"",""PK"" & REPT("" "",3)," & _
"IF(PedidosImp!RC[-11]=""CL"",""CT"" & REPT("" "",3)," & _
"IF(PedidosImp!RC[-11]=""LT"",""L"" & REPT("" "",4)," & _
"IF(PedidosImp!RC[-11]=""PR"",""PAR"" & REPT("" "",2)," & _
"IF(PedidosImp!RC[-11]=""MT"",""M"" & REPT("" "",4)," & _
"PedidosImp!RC[-11] & REPT("" "",5-LEN(PedidosImp!RC[-11])))))), REPT("" "",10))"

MsgBox Len(myStr)

UF = InputBox("Aperte Enter.", "", myStr)

MsgBox Len(UF)

HTH,
Bernie
MS Excel MVP


"Lunks" wrote in message
oups.com...
I'm getting "Compile Error: Expected: list separator or )"
With the following formula:
UF = InputBox("Aperte Enter.","
","=IF(PedidosImp!RC[-20]="""",IF(PedidosImp!RC[-11]=""ML"",""MIL"" &
REPT("" "",2),IF(PedidosImp!RC[-11]=""PT"",""PK"" & REPT(""
"",3),IF(PedidosImp!RC[-11]=""CL"",""CT"" & REPT(""
"",3),IF(PedidosImp!RC[-11]=""LT"",""L"" & REPT(""
"",4),IF(PedidosImp!RC[-11]=""PR"",""PAR"" & REPT(""
"",2),IF(PedidosImp!RC[-11]=""MT"",""M"" & REPT(""
"",4),PedidosImp!RC[-11] _
&REPT("" "",5-LEN(PedidosImp!RC[-11])))))),REPT("" "",10))"



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default InputBox default value?

I'm getting error on the following part of the program:
Range("Z1").Select
ActiveCell.FormulaR1C1 = myStr
Selection.Copy
Range("Z1:Z" & ncl).PasteSpecial

Error: Run-time error '1004':
Application-defined or object-defined error

myStr is exactly as you posted.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Default Windows Profile without default Office user info Karen Excel Discussion (Misc queries) 0 November 12th 08 04:53 PM
Default ribbon to open by default when opening xls in browser Hank Excel Discussion (Misc queries) 0 April 10th 08 10:12 PM
Inputbox and Application.InputBox Maria[_7_] Excel Programming 1 September 20th 04 11:36 AM
Application.InputBox with Default:=0 testing False bluhme Excel Programming 2 June 24th 04 12:35 PM
Excel VBA - InputBox DEFAULT Value? BruceAtkinson[_3_] Excel Programming 3 May 26th 04 08:18 PM


All times are GMT +1. The time now is 07:50 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"