ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Get Active Sheet (https://www.excelbanter.com/excel-programming/394432-get-active-sheet.html)

Scott

Get Active Sheet
 
I've got the worksheet and cell hard-coded below. What's the syntax to
replace "sheet1" withe name of the active worksheet and replace "a7" with
the active cell?

I'd like to be able to assign both above mentioned values to variables like
"pageActive" and "cellActive" and then be able to insert those variables
into the code below. I'm familiar with Access VBA, but don't know how to
treat Excel's vba variables and quotes.

CODE:

Worksheets("sheet1").Range("a7").Value



Jim Thomlinson

Get Active Sheet
 
I'm not just 100% sure what you want but here goes

dim strActiveSheet as String
dim strActiveCell as String

strActiveSheet = ActiveSheet.Name
strActiveCell = ActiveCell.Address
Worksheets(strActiveSheet).Range(strActiveCell).Va lue

--
HTH...

Jim Thomlinson


"scott" wrote:

I've got the worksheet and cell hard-coded below. What's the syntax to
replace "sheet1" withe name of the active worksheet and replace "a7" with
the active cell?

I'd like to be able to assign both above mentioned values to variables like
"pageActive" and "cellActive" and then be able to insert those variables
into the code below. I'm familiar with Access VBA, but don't know how to
treat Excel's vba variables and quotes.

CODE:

Worksheets("sheet1").Range("a7").Value




Scott

Get Active Sheet
 
that get's it.

"Jim Thomlinson" wrote in message
...
I'm not just 100% sure what you want but here goes

dim strActiveSheet as String
dim strActiveCell as String

strActiveSheet = ActiveSheet.Name
strActiveCell = ActiveCell.Address
Worksheets(strActiveSheet).Range(strActiveCell).Va lue

--
HTH...

Jim Thomlinson


"scott" wrote:

I've got the worksheet and cell hard-coded below. What's the syntax to
replace "sheet1" withe name of the active worksheet and replace "a7" with
the active cell?

I'd like to be able to assign both above mentioned values to variables
like
"pageActive" and "cellActive" and then be able to insert those variables
into the code below. I'm familiar with Access VBA, but don't know how to
treat Excel's vba variables and quotes.

CODE:

Worksheets("sheet1").Range("a7").Value







All times are GMT +1. The time now is 10:33 PM.

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