ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Capturing current Worksheet Name as a variable (https://www.excelbanter.com/excel-programming/408856-capturing-current-worksheet-name-variable.html)

Jimbob

Capturing current Worksheet Name as a variable
 
I have a workbook with several sheets for different types of client. I need
to capture the client type from the sheet name but how to do this with VBA is
a mystery.

Any support gratefuly received.
Many Thanks

Jim Thomlinson

Capturing current Worksheet Name as a variable
 
Try this...

sub test()
msgbox activesheet.name
end sub
--
HTH...

Jim Thomlinson


"Jimbob" wrote:

I have a workbook with several sheets for different types of client. I need
to capture the client type from the sheet name but how to do this with VBA is
a mystery.

Any support gratefuly received.
Many Thanks


Jason Lepack

Capturing current Worksheet Name as a variable
 
Public Sub ws_name()
Dim s As String
s = ActiveSheet.Name
MsgBox s
End Sub



On Apr 4, 3:03 pm, Jimbob wrote:
I have a workbook with several sheets for different types of client. I need
to capture the client type from the sheet name but how to do this with VBA is
a mystery.

Any support gratefuly received.
Many Thanks



Jimbob

Capturing current Worksheet Name as a variable
 
Jason and Jim
You guys are amazing - and so quick

Thank you


"Jason Lepack" wrote:

Public Sub ws_name()
Dim s As String
s = ActiveSheet.Name
MsgBox s
End Sub



On Apr 4, 3:03 pm, Jimbob wrote:
I have a workbook with several sheets for different types of client. I need
to capture the client type from the sheet name but how to do this with VBA is
a mystery.

Any support gratefuly received.
Many Thanks





All times are GMT +1. The time now is 07:23 AM.

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