Sie sind auf Seite 1von 1

Public Function SHEETNAME(SheetNumber As Integer, Optional ByRef CalledFrom As R ange) As String 'Created by Rainer A. Niederoest (908.619.

4550) 'Modified by RAN on 05-17-11 to allow the user to prevent problems when moving b ack and forth ' between differnt workbooks Dim TheBook As String 'MsgBox ("test") On Error GoTo No_CalledFrom_Provided TheBook = BOOKNAMEIS(CalledFrom) SHEETNAME = Workbooks(TheBook).Sheets(SheetNumber).Name On Error GoTo 0 GoTo End_of_SHEETNAME No_CalledFrom_Provided: SHEETNAME = Sheets(SheetNumber).Name End_of_SHEETNAME: 'When adding this code to a macro enabled workbook you can use this code instead 'SHEETNAME = ThisWorkbook.Sheets(SheetNumber).Name End Function

Das könnte Ihnen auch gefallen