select cell

  • Thread starter Thread starter divid wells
  • Start date Start date
D

divid wells

is there any way i can moniter the next cellwhich is
selected ? It occurs inthe midle of a macro and the user
needs to select a cell by clicking on it, and the value
of that is used in the rest of the macro.

this can either be done with a vba macro or a userform
but im guessing the code will all b the same.

Thank you for youre help
 
Hi David;

One way is to use a call for an Input Box and then declare
the type to 8. That will force the user to return a range
that you can then use.

Thanks,

Greg
 
Actually, the Excel inputbox supports the type 8 syntax

Sub SelectRange()
Dim rng As Range
On Error Resume Next
Set rng = Application.InputBox("Select cell with you mouse", Type:=8)
On Error GoTo 0
If rng Is Nothing Then
MsgBox "You clicked cancel; hit OK/enter to exit macro"
Exit Sub
End If
MsgBox "Range selected is " & rng.Address(0, 0, , True)

End Sub
 
i'm not very good at these things, but a RefEdit control would work i
think - especially if you need to navigate about the workbook when deciding
which cell needs selecting (which could go onto your userform if you have
one)
 

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

Back
Top