ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel VBA Sheet(variable).range... possible ? (https://www.excelbanter.com/excel-programming/367595-excel-vba-sheet-variable-range-possible.html)

phil

Excel VBA Sheet(variable).range... possible ?
 
Hi Everyone,

is it possible to add a variable to the sheet(var).range("A1").select
expression? I know of the sheets("name") expression, but this is a workbook
that contains multiple sheets, no naming convention, and requires me to go
back, forth and skip some sheets depending on user input.

Example:

Var = 10
sheet(Var).range("A1").select

would give:
sheet10.range("A1").select





excelent

Excel VBA Sheet(variable).range... possible ?
 
Sub tst()
Var = 3
Sheets("Sheet" & Var).Activate
Range("A1").Select
End Sub


"Phil" skrev:

Hi Everyone,

is it possible to add a variable to the sheet(var).range("A1").select
expression? I know of the sheets("name") expression, but this is a workbook
that contains multiple sheets, no naming convention, and requires me to go
back, forth and skip some sheets depending on user input.

Example:

Var = 10
sheet(Var).range("A1").select

would give:
sheet10.range("A1").select






All times are GMT +1. The time now is 09:44 AM.

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