A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

VBA selecting an input range of cells



 
 
Thread Tools Display Modes
  #1  
Old April 18th, 2010, 08:31 PM posted to microsoft.public.excel.misc
Colin Hayes
external usenet poster
 
Posts: 313
Default VBA selecting an input range of cells


Hi

I have a small request for help with code.

I need a simple macro to have popups request the first and last cells in
a range , and then to select the range indicated in the popups.

Can someone help?

Grateful for any assistance
  #2  
Old April 18th, 2010, 09:22 PM posted to microsoft.public.excel.misc
Gary''s Student
external usenet poster
 
Posts: 7,584
Default VBA selecting an input range of cells

Something like:

Sub PickaRanage()
Dim s1 As String, s2 As String, s3 As String
s1 = Application.InputBox(prompt:="Enter address of first cell", Type:=2)
s2 = Application.InputBox(prompt:="Enter address of last cell", Type:=2)
Range(s1 & ":" & s2).Select
End Sub

--
Gary''s Student - gsnu201001


"Colin Hayes" wrote:


Hi

I have a small request for help with code.

I need a simple macro to have popups request the first and last cells in
a range , and then to select the range indicated in the popups.

Can someone help?

Grateful for any assistance
.

  #3  
Old April 18th, 2010, 10:38 PM posted to microsoft.public.excel.misc
Colin Hayes
external usenet poster
 
Posts: 313
Default VBA selecting an input range of cells

In article , Gary''s
Student writes
Something like:

Sub PickaRanage()
Dim s1 As String, s2 As String, s3 As String
s1 = Application.InputBox(prompt:="Enter address of first cell", Type:=2)
s2 = Application.InputBox(prompt:="Enter address of last cell", Type:=2)
Range(s1 & ":" & s2).Select
End Sub


HI

OK Thanks - that's perfect.

Out of interest , if you made the s1 line Type:=8 , what change would
you need to make in the

Range(s1 & ":" & s2).Select

line?



Best Wishes
  #4  
Old April 19th, 2010, 12:36 AM posted to microsoft.public.excel.misc
Gary''s Student
external usenet poster
 
Posts: 7,584
Default VBA selecting an input range of cells

Good question:

Sub Range8()
Dim r1 As Range, r2 As Range
Set r1 = Application.InputBox(prompt:="Enter address of first cell", Type:=8)
Set r2 = Application.InputBox(prompt:="Enter address of last cell", Type:=8)
Range(r1, r2).Select
End Sub

and you can use the mouse to service the input boxs.
--
Gary''s Student - gsnu201001


"Colin Hayes" wrote:

In article , Gary''s
Student writes
Something like:

Sub PickaRanage()
Dim s1 As String, s2 As String, s3 As String
s1 = Application.InputBox(prompt:="Enter address of first cell", Type:=2)
s2 = Application.InputBox(prompt:="Enter address of last cell", Type:=2)
Range(s1 & ":" & s2).Select
End Sub


HI

OK Thanks - that's perfect.

Out of interest , if you made the s1 line Type:=8 , what change would
you need to make in the

Range(s1 & ":" & s2).Select

line?



Best Wishes
.

  #5  
Old April 19th, 2010, 02:17 AM posted to microsoft.public.excel.misc
Colin Hayes
external usenet poster
 
Posts: 313
Default VBA selecting an input range of cells

In article , Gary''s
Student writes
Good question:

Sub Range8()
Dim r1 As Range, r2 As Range
Set r1 = Application.InputBox(prompt:="Enter address of first cell", Type:=8)
Set r2 = Application.InputBox(prompt:="Enter address of last cell", Type:=8)
Range(r1, r2).Select
End Sub

and you can use the mouse to service the input boxs.


Hi

OK Thanks. This allows input by keyboard and/or mouse I see.

Perfect first time again. I'm grateful for your time and expertise.


Best wishes
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:06 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.