ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Dynamic Range Selection (https://www.excelbanter.com/excel-programming/423722-dynamic-range-selection.html)

Phil P[_2_]

Dynamic Range Selection
 
I have a spreadsheet that goes to say column S and several thousand rows.
I would like the program to request a user to highlight a Range for example
A50:A55 (this is a variable range however the selections would always be in
column A. Based on the user selected range the range would be named and
program would execute code for the adjacent cells in the selected range.

Can you please assist with this code?


Gary''s Student

Dynamic Range Selection
 
ub ordinate()
Dim r As Range
Set r = Application.InputBox(prompt:="select the range", Type:=8)
r.Name = "whatever"
For Each rr In Range("whatever")
rr.Offset(0, 1).Value = "anything you like"
Next
End Sub

The user can either type the range or use the mouse. The macro then enters
stuff to the right of the selected range.
--
Gary''s Student - gsnu200832


"Phil P" wrote:

I have a spreadsheet that goes to say column S and several thousand rows.
I would like the program to request a user to highlight a Range for example
A50:A55 (this is a variable range however the selections would always be in
column A. Based on the user selected range the range would be named and
program would execute code for the adjacent cells in the selected range.

Can you please assist with this code?


Phil P[_2_]

Dynamic Range Selection
 
Thanks so much for your help Gary. I will put your code in program and work
with it. Sorry for the duplicate message. I received a message failed
notification when I originally posted.

"Gary''s Student" wrote:

ub ordinate()
Dim r As Range
Set r = Application.InputBox(prompt:="select the range", Type:=8)
r.Name = "whatever"
For Each rr In Range("whatever")
rr.Offset(0, 1).Value = "anything you like"
Next
End Sub

The user can either type the range or use the mouse. The macro then enters
stuff to the right of the selected range.
--
Gary''s Student - gsnu200832


"Phil P" wrote:

I have a spreadsheet that goes to say column S and several thousand rows.
I would like the program to request a user to highlight a Range for example
A50:A55 (this is a variable range however the selections would always be in
column A. Based on the user selected range the range would be named and
program would execute code for the adjacent cells in the selected range.

Can you please assist with this code?



All times are GMT +1. The time now is 12:00 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com