ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel VBA - InputBox DEFAULT Value? (https://www.excelbanter.com/excel-programming/299568-excel-vba-inputbox-default-value.html)

BruceAtkinson[_3_]

Excel VBA - InputBox DEFAULT Value?
 
Can the DEFAULT parameter in an InputBox, reference a cell? I woul
like to use the value in another cell as the InputBox Default value.
Can this be done? If so, how; especially on another worksheet?
Thanks,
Bruc

--
Message posted from http://www.ExcelForum.com


Tom Ogilvy

Excel VBA - InputBox DEFAULT Value?
 
res = InputBox( Prompt:="Enter something", Default:= _
Worksheets("Sheet3").Range("A9").Value)


or use Worksheets("Sheet3:").Range("A9").Text

if you want it to be entered as it is displayed by the cell.

--
Regards,
Tom Ogilvy


"BruceAtkinson " wrote in
message ...
Can the DEFAULT parameter in an InputBox, reference a cell? I would
like to use the value in another cell as the InputBox Default value.
Can this be done? If so, how; especially on another worksheet?
Thanks,
Bruce


---
Message posted from http://www.ExcelForum.com/




BruceAtkinson[_4_]

Excel VBA - InputBox DEFAULT Value?
 
Thanks Tom, I appreciate your help

--
Message posted from http://www.ExcelForum.com


steveB

Excel VBA - InputBox DEFAULT Value?
 
Bruce,

Yep! Here's using a named cell, and using a cell reference...

''''''''''''''''
Dim mssg As String

mssg = InputBox("do your thing", "my thing",
Sheets("Sheet3").Range("Function"))
mssg = InputBox("do your thing", "my thing", Sheets("Sheet3").Range("B5"))
'''''''''''''''''''''
hth
--

steveB

(Remove 'NOSPAM' from email address if contacting me direct)


"BruceAtkinson " wrote in
message ...
Can the DEFAULT parameter in an InputBox, reference a cell? I would
like to use the value in another cell as the InputBox Default value.
Can this be done? If so, how; especially on another worksheet?
Thanks,
Bruce


---
Message posted from http://www.ExcelForum.com/





All times are GMT +1. The time now is 09:45 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com