Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Trying to select a specific range based on the time value of user form input Jitranijam New Users to Excel 8 November 15th 06 12:52 AM
Select Cell Range Debra Ann Excel Programming 5 March 2nd 06 08:26 PM
Select last cell in range PaulSin Excel Programming 3 June 8th 04 10:59 AM
select last cell in used range Tony P Excel Programming 1 January 7th 04 06:41 AM
My First User Form - How to Select Range(s) and Print Bruce Roberson[_2_] Excel Programming 3 July 25th 03 03:09 AM


All times are GMT +1. The time now is 10:06 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"