Inputbox used to return value of selected cell

  • Thread starter Thread starter D.S.
  • Start date Start date
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)
 
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)
 
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)
 
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
 
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)
 
I think that's what I'm looking for. Forgot about <application.inputbox>

D.S.

Donald (e-mail address removed)
 
Back
Top