ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Create a Macro to Range Cells, from the contents of another Cell. (https://www.excelbanter.com/excel-programming/409180-create-macro-range-cells-contents-another-cell.html)

Denis Lory

Create a Macro to Range Cells, from the contents of another Cell.
 
Hi Guys.

A Workbook containing 3 sheets.
Using the formula Range("A1:D2").Select, can the data "A1" and "D2"
inside the formula be substituted with the contents of another cell?
For example:
Using the formula Range("A1:D2").Select to select data from sheet 1,
replace "A1" & "D2" from the cell "J4" & "K4" in sheet 2, which has the
correct ranges, and then the result pasted in sheet 3.
Sheet 2 has the data ranges required, and they change frequently.
Is this possible? Can an automation be done to range formulas with
information from another cell?

Any help is much appreciated.
Denis


*** Sent via Developersdex http://www.developersdex.com ***

UKNewbie

Create a Macro to Range Cells, from the contents of another Cell.
 
Hi Denis,

You can use a value on Sheet2 in your range. Simply reference the cell
explicitly or assign the cells value to a variable e.g

Sheet1.Range(Sheet2.Cells(1,1).Text).Select

or

myRange=Sheet2.Cells(1,1).Text
Sheet1.Range(myRange).Select

Sheet1 would need to be the active sheet.

Hope this helps,

Mike

"Denis Lory" wrote:

Hi Guys.

A Workbook containing 3 sheets.
Using the formula Range("A1:D2").Select, can the data "A1" and "D2"
inside the formula be substituted with the contents of another cell?
For example:
Using the formula Range("A1:D2").Select to select data from sheet 1,
replace "A1" & "D2" from the cell "J4" & "K4" in sheet 2, which has the
correct ranges, and then the result pasted in sheet 3.
Sheet 2 has the data ranges required, and they change frequently.
Is this possible? Can an automation be done to range formulas with
information from another cell?

Any help is much appreciated.
Denis


*** Sent via Developersdex http://www.developersdex.com ***



All times are GMT +1. The time now is 01:17 PM.

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