excel 取得工作表名(Excel gets the worksheet name)Excel gets the worksheet name
Method one
Conventional method cell function
You can also get the worksheet name and enter in either cell:
=RIGHT (CELL ("filename"), "LEN" (CELL ("filename")), "-FIND" ["]," CELL "(" filename "))
Method two
Take the worksheet name and path =CELL ("filename", "$A$1") Take workbook and table name
=MID (CELL ("filename", "$A$1"), "FIND" [[], CELL ("filename", "$A$1")), "LEN" ("CELL" ("filename", "$A$1")) "+1-FIND" [[], CELL ("filename", "$A$1"))
Take the workbook name
=MID (CELL (filename), $A$1), FIND ([), CELL (filename, $A$1)), FIND ([)], CELL ('filename', '$A$1'), '-FIND' (',' ',' CELL '(' filename ',' $A$1 ')),' +1 ')
Get table name
=MID (CELL (filename), $A$1), FIND ([)], CELL ("filename",
"$A$1")), "+1", "LEN" (CELL ("filename", "$A$1")), "-FIND" [[]], "CELL" ("filename", "$A$1"))
Method three
Define a name called MC, write the reference location to
=ll (66), and then enter the =mc in any cell to get the current workbook name.
Define a name called MCB, write the reference location to
=ll (62) or =ll (32), and then enter the =mcb in any cell to get the current workbook and worksheet name.
Supplementary A
Take the name of this table:
Define X=MID (GET.DOCUMENT (1), FIND ([)], GET.DOCUMENT (1)), +1100)
Enter =X in each table
Supplementary B
Define a name that is abbreviated as MCB, where the reference is written to =ll (62) or =ll (32), and then entered in any cell
=RIGHT (mcb2, LEN (mcb2), -SEARCH ([)], mcb2,1) can get the name of the worksheet
Supplementary C
Define a name that is abbreviated as MCB, where the reference is written to =ll (62) or =ll (32), and then entered in any cell
=MID (MCB, SEARCH ([)], mcb2,1) +1100 can get the name of the worksheet
Add D knowledge point 1
GET.DOCUMENT macrosheet function description
Syntax GET.DOCUMENT (type_num, name_text)
Type_num specifies the number of message types. The following table lists the possible values of type_num and the corresponding results.
Type_num returns
1 if there is more than one table in the workbook, the file name of the worksheet is returned in the form of [Book1] sheet1. Otherwise, only the file name of the workbook is returned. Workbook file name does not include drive, directory, or window number. It is usually best to use GET. DOCUMENT (76)
And GET. DOCUMENT (88) to return the file name of the active worksheet and active workbook.
2 as the text, including the name_text directory path. If
Workbook name_text is not saved, the error value #N/A is returned
3 specifies the number of file types
1 = worksheet
2 = chart
3 = macrosheet
4 = active information window
5 = reserved documents
6 = module table
7 = dialog edit table
4 returns the TRUE if the table changes after the last storage of the file; otherwise, returns FALSE.
5 if the table is read-only, return TRUE; otherwise, return FALSE.
6 if the table is set with password to protect, return TRUE; otherwise, return FALSE.
7 returns TRUE if the cells in the table, the contents in the table, or the series in the diagram are returned; otherwise, return FALSE.
8 if the workbook window is protected, return TRUE; otherwise, return FALSE.
The values of the following four type_num are used only for diagrams.
Type_num returns
9 the number of types indicating the master chart.
1 = area diagram
2 = bar chart
getsavefilename3 = cylindrical graph
4 = line shape
5 = pie
6 = XY (scatter diagram)
7 = 3D area map
8 = 3D column diagram
9 = 3D line graph
10 = 3D pie chart

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。