WoodCentral Forums

Est. 1998 — 27 years of woodworking knowledge

OT: MS Excel help needed

Posts

OT: MS Excel help needed

#1

OT: MS Excel help needed

Luke Herzberg

>Howdy folks, how can I use the name of a worksheet tab in a cell elsewhere? For example, I make a macro to add another worksheet tab and also create a new line in a summary worksheet. If I name the new worksheet "Febuary" how can I look at the name of that worksheet, and display its name in a cell on the new line in the summary sheet?

Thanks,

Luke

Re: OT: MS Excel help needed

#2

Re: OT: MS Excel help needed

Dan Donaldson

>There is probably a way, but need a bit more info on exactly what you need to do.

Re: OT: MS Excel help needed

#3

Re: OT: MS Excel help needed *LINK*

wilbur

>I think this page will help you with what you're looking to do.


Variable worksheet names in Excel

Re: OT: MS Excel help needed

#4

Re: OT: MS Excel help needed *LINK*

Craig P

>Look into asap utilities - quite useful & free, though from your post may not be exactly what you're looking for. Something similar that I needed at one point was the vba snippet:



Function lsheetname(Optional sheet_num As Long) As String
If sheet_num < 0 Then
MsgBox "Value must either be blank or positive integer"
Exit Function
Else: If sheet_num = 0 Then sheet_num = ActiveWorkbook.Worksheets.Count
End If
lsheetname = ActiveWorkbook.Worksheets(sheet_num).Name
End Function




In any cell can put the the following:'

=lsheetname()

and the name of the last sheet will be returned. Else

=lsheetname(2)

will return the name of the second sheet, etc.


asap-utilities.com

Re: OT: MS Excel help needed

#5

Thanks, that did it!

Luke Herzberg

>I guess a better explanation of what I needed was how to extract filenames, and then the worksheet name from within that.

Whatever it's called, it did what I needed.

Thanks,

Luke

👍 This page answered my questions

Your vote helps other woodworkers quickly find the answers and techniques that actually work in the shop.