![]() |
how to select cell range with form?
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 |
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 |
how to select cell range with form?
ok, I figured it out. Code: -------------------- Private Sub CommandCancel_Click() Unload Me End Sub ---------------------------------- Private Sub CommandSelect_Click() Range(txtStart.Value, txtEnd.Value).Select End Sub ---------------------------------- Private Sub UserForm_Initialize() txtStart.Value = "" txtEnd.Value = "" txtStart.SetFocus End Sub -------------------- -- jagexcel ------------------------------------------------------------------------ jagexcel's Profile: http://www.excelforum.com/member.php...o&userid=35657 View this thread: http://www.excelforum.com/showthread...hreadid=554395 |
how to select cell range with form?
Thanks a lot, Norman -- jagexce ----------------------------------------------------------------------- jagexcel's Profile: http://www.excelforum.com/member.php...fo&userid=3565 View this thread: http://www.excelforum.com/showthread.php?threadid=55439 |
All times are GMT +1. The time now is 08:02 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com