ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Get ActiveSheet name in VB (https://www.excelbanter.com/excel-programming/312963-get-activesheet-name-vbulletin.html)

Geoff Lambert[_2_]

Get ActiveSheet name in VB
 
This must surely be one of the simplest VB questions??

I am trying to figure out how to extract the name (tab name) of the
active sheet into VB, so I can then concatenate it into a longer string
that specifies a query file.

i.e. on ActiveSheet "FRED", I want to extract the string "FRED" and then
build the string "FRED.IQY"

As it happens, I have an add-in worksheet function Sheetname() that will
produce this name for me. So I can have a cell (e.g. at C2 that already
has the string "FRED" in it

My problem is to extract this from either cell C2 or fron the name of
the ActiveSheet into a string.

There are 150 sheets in my workbook. I want the macros to be run on only
the ActiveSheet

It must be a very simple syntax and code.

But what is it?

Thanks

Geoff Lambert


Tom Ogilvy

Get ActiveSheet name in VB
 
sStr = ActiveSheet.Name & ".IQY"

--
Regards,
Tom Ogilvy

"Geoff Lambert" wrote in message
u...
This must surely be one of the simplest VB questions??

I am trying to figure out how to extract the name (tab name) of the
active sheet into VB, so I can then concatenate it into a longer string
that specifies a query file.

i.e. on ActiveSheet "FRED", I want to extract the string "FRED" and then
build the string "FRED.IQY"

As it happens, I have an add-in worksheet function Sheetname() that will
produce this name for me. So I can have a cell (e.g. at C2 that already
has the string "FRED" in it

My problem is to extract this from either cell C2 or fron the name of
the ActiveSheet into a string.

There are 150 sheets in my workbook. I want the macros to be run on only
the ActiveSheet

It must be a very simple syntax and code.

But what is it?

Thanks

Geoff Lambert





All times are GMT +1. The time now is 07:16 PM.

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