Hi, like this:-
Private Sub CommandButton1_Click()
YourSub Range(Me.RefEdit1)
End Sub
Sub YourSub(AnyRange As Range)
'Do whatever
End Sub
You may be interested to know that you can use an inputbox which will allow the user to select a range with the mouse i.e.
Sub UseApplicationInputBox()
Dim rngeGetARange As Range
On Error Resume Next
Set rngeGetARange = Application.InputBox("Please select range...", "Select", , , , , , 8)
If rngeGetARange Is Nothing Then Exit Sub
rngeGetARange.Value = "Hello!"
End Sub
HTH,
D
Thank you very much... Just one more thing>>>
HI DK: thank you for your answer...
I've tried your sub example, maybe I'm wrong, but does the "8" in your example means "type=8"?, If so, maybe my version of excel doesn't fully support VBA, 'cause I have tried it before and it never shows the navigation option.( as a matter of fact, your example inputbox looks exactly the same as mine, without navigation button)
I haven't tried userform example, but I'll let you know...
Thank You Very Much.
Re: Thank you very much... Just one more thing>>>
Alfredo,
The 8 does indeed mean Type=8. You have to use the Application.Inputbox if you want to use this (Excel's own inputbox). If you omit the application bit then you will just be using a standard VB inputbox. I'm using Excel 2000 but I'm sure that this was also available in Excel 97.
Regards,
D