Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

Is it possible to say view the current value of cell A3 in the inputbox text?

This is what I'm using.

Dim strValue As String  
strValue = Application.InputBox("A3 <- Is the current value, Enter new value", "Value A3")  
ActiveWorkbook.Sheets("Sheet1").Range("A1") = strValue
share|improve this question

2 Answers 2

Consider:

Sub ytrewq()
    Dim s As String
    s = "Current value in A3 is " & Range("A3").Text & " ;enter a new value"
    Range("A3").Value = Application.InputBox(prompt:=s)
End Sub
share|improve this answer
    
+1 Nice one Gary :) But both the answers need to handle False part of the InputBox –  Siddharth Rout Feb 16 at 8:24

Application.InputBox includes a default parameter as the third argument so use this to place the current value directly in the box

Dim strValue As String
strValue = Application.InputBox("Enter new value", "Hello World", [a3].Value, , , , , 1)
ActiveWorkbook.Sheets("Sheet1").Range("A1") = strValue

enter image description here

share|improve this answer
1  
+ 1 Someone is already active on a Sunday :P –  Siddharth Rout Feb 16 at 8:23

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.