View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default how to select cell range with form?

Hi JagExcel,

Try something like:

'=============
Public Sub Tester()
Dim rng As Range

On Error Resume Next
Set rng = Application.InputBox _
(Prompt:="Select the required range", _
Type:=8)
On Error GoTo 0

If Not rng Is Nothing Then
' do something e.g:
rng.Interior.ColorIndex = 6
Else
MsgBox "You cancelled"
End If

End Sub
'<<=============


---
Regards,
Norman



"jagexcel" wrote in
message ...

How do I make a form that has 2 fields that user can define the range of
cells they want to select? For example, if the user enter A1 in the
first field, and C3 in the second field, and press the OK button, the
cells from A1 to C3 (A1:C3) will be selected?

Thank you very much.


--
jagexcel
------------------------------------------------------------------------
jagexcel's Profile:
http://www.excelforum.com/member.php...o&userid=35657
View this thread: http://www.excelforum.com/showthread...hreadid=554395