Inputbox used to return value of selected cell

D

D.S.

Anyone know how I can use the inputbox so that the value of the inputbox is
determined by the cell I select with my mouse?

Donald (e-mail address removed)
 
D

D.S.

Not exactly what I should have asked.

I'm trying to return the cell address to the input box when I select a cell
with the mouse.

D.S.

Donald (e-mail address removed)
 
B

Bob Phillips

Donald,

Using Application.Inputbox you can select a cell.

This code sets a cell to that value
myCell = Application.InputBox(prompt:="Select a cell", Type:=8)


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
H

Harald Staff

Hi Donald

Not too sure I understand what you're after. But here's an inputbox that
prompts you to click a cell and returns the clicked cell and its address.
Who knows, maybe you need exactly that one day ?

Sub ClickACell()
Dim R As Range
On Error Resume Next
Set R = Application.InputBox("Click a cell:", _
Default:=ActiveCell.Address, _
Type:=8)
If R Is Nothing Then
MsgBox "cluck cluck"
Else
Set R = R(1)
MsgBox R.Address, , "A fine choice!"
End If
End Sub
 
B

Bob Phillips

Donald,

Just tag .Address to the end.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
D

D.S.

I think that's what I'm looking for. Forgot about <application.inputbox>

D.S.

Donald (e-mail address removed)
 

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

Top