ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Range select (https://www.excelbanter.com/excel-programming/342362-range-select.html)

Gary''s Student

Range select
 
My user will select a range of cells in Sheet1 then I need some code that will:

1. Activate Sheet2
2. Select the same range of cells in Sheet2 that the user selected in Sheet1

Thanks in advance
--
Gary's Student

JE McGimpsey

Range select
 
One way:

Application.GoTo Sheets("Sheet2").Range(Selection.Address)

In article ,
Gary''s Student wrote:

My user will select a range of cells in Sheet1 then I need some code that
will:

1. Activate Sheet2
2. Select the same range of cells in Sheet2 that the user selected in Sheet1

Thanks in advance


Bernie Deitrick

Range select
 
Gary's Student,

Dim myRange As Range
Set myRange = Selection
Worksheets("Sheet2").Activate
Range(myRange.Address).Select

Or, to do it within a running macro:

Dim myRange As Range
'Other code here
Set myRange = Application.InputBox("Select Cells", , , , , , , 8)
Worksheets("Sheet2").Activate
Range(myRange.Address).Select


HTH,
Bernie
MS Excel MVP


"Gary''s Student" wrote in message
...
My user will select a range of cells in Sheet1 then I need some code that
will:

1. Activate Sheet2
2. Select the same range of cells in Sheet2 that the user selected in
Sheet1

Thanks in advance
--
Gary's Student




Gary''s Student

Range select
 
Thank you both very much
--
Gary's Student


"Bernie Deitrick" wrote:

Gary's Student,

Dim myRange As Range
Set myRange = Selection
Worksheets("Sheet2").Activate
Range(myRange.Address).Select

Or, to do it within a running macro:

Dim myRange As Range
'Other code here
Set myRange = Application.InputBox("Select Cells", , , , , , , 8)
Worksheets("Sheet2").Activate
Range(myRange.Address).Select


HTH,
Bernie
MS Excel MVP


"Gary''s Student" wrote in message
...
My user will select a range of cells in Sheet1 then I need some code that
will:

1. Activate Sheet2
2. Select the same range of cells in Sheet2 that the user selected in
Sheet1

Thanks in advance
--
Gary's Student






All times are GMT +1. The time now is 04:58 PM.

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