Показать сообщение отдельно
Старый 07.09.2007, 20:37   #2  
Gustav is offline
Gustav
Moderator
Аватар для Gustav
SAP
Лучший по профессии 2009
 
1,858 / 1152 (42) ++++++++
Регистрация: 24.01.2006
Адрес: Санкт-Петербург
Записей в блоге: 19
Цитата:
Сообщение от kashperuk Посмотреть сообщение
Макрос в Excel что-то ничего на это действие нажатия по плюсику не записывает
Если сделать не "плюсиком", а по меню: Данные \ Группа и структура \ Отобразить данные, то в VBA запишется оператор примерно следующего вида (Application добавил я для наглядности):
Код:
Application.ExecuteExcel4Macro "SHOW.DETAIL(1,3,TRUE,,0)"
далее в справочнике по макрофункциям Excel 4 читаем:
Цитата:
SHOW.DETAIL
Macro Sheets Only

Expands or collapses the detail under the specified expand or collapse button.

Syntax

SHOW.DETAIL(rowcol, rowcol_num, expand, show_field)

Rowcol is a number that specifies whether to operate on rows or columns of data.

Rowcol Operates on
1 Rows
2 Columns
3 The current cell's row or column. The second argument, rowcol_num, is then ignored.


Rowcol_num is a number that specifies the row or column to expand or collapse. If you are in A1 mode, you must still give the column as a number. If rowcol_num is not a summary row or column, SHOW.DETAIL returns the #VALUE! error value and interrupts the macro.

Expand is a logical value that specifies whether to expand or collapse the detail under the row or column. If expand is TRUE, Microsoft Excel expands the detail under the row or column; if FALSE, it collapses the detail under the row or column. If expand is omitted, the detail is expanded if it is currently collapsed and collapsed if it is currently expanded.

Show_Field is a string specifying the name of the field to add to a PivotTable report, if the selection is inside a PivotTable report. The new field is added as the new innermost field. Available for only innermost row or column fields.

Related Function

SHOW.LEVELS Displays a specific number of levels of an outline
P.S. Записывается макрорекордером почему-то 5 аргументов, а не 4 как сказано в хелпе. Если после записи попробовать выполнить этот оператор ExecuteExcel4Macro "SHOW.DETAIL(1,3,TRUE,,0)", то возникнет ошибка типа "Много аргументов". Достаточно в принципе первых трех.