Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
dan dan is offline
external usenet poster
 
Posts: 866
Default Data - Group - Hide Details

Trying to include the "Hide details" command in a macro but with variables

Dim Ctr1 As Variant
Dim Ctr2 As Variant

Ctr1 = 8
Ctr2 = 23

Rows(Ctr1 & ":" & Ctr2).Select
worksSelection.Rows.Group
ExecuteExcel4Macro "SHOW.DETAIL(1,23,FALSE,,7)" - works

ExecuteExcel4Macro "SHOW.DETAIL(1,Ctr2,FALSE,,Ctr1 - 1)" - does not work
Get a Run-time error '1004' -You've entered too many arguments for this
equation.

Any ideas?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Data - Group - Hide Details

How about:

ExecuteExcel4Macro "SHOW.DETAIL(1," & ctr2 & ",FALSE,," & ctr1-1 & ")"

Untested!

And why not declare them as longs?

Dan wrote:

Trying to include the "Hide details" command in a macro but with variables

Dim Ctr1 As Variant
Dim Ctr2 As Variant

Ctr1 = 8
Ctr2 = 23

Rows(Ctr1 & ":" & Ctr2).Select
worksSelection.Rows.Group
ExecuteExcel4Macro "SHOW.DETAIL(1,23,FALSE,,7)" - works

ExecuteExcel4Macro "SHOW.DETAIL(1,Ctr2,FALSE,,Ctr1 - 1)" - does not work
Get a Run-time error '1004' -You've entered too many arguments for this
equation.

Any ideas?


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
dan dan is offline
external usenet poster
 
Posts: 866
Default Data - Group - Hide Details

Now I have more issues. I generated the macro on Excel 2002 (by using the
record command) and replaced the variables myself. As for the Variant vs Long
- no reason just wasn't paying that much attention when I created the
variables to test.

Now running the macro in 2003 generates the same error for both
"ExecuteExcel4Macro" commands (even the one generated by the record command).
Both still do not "hide" the details.


"Dave Peterson" wrote:

How about:

ExecuteExcel4Macro "SHOW.DETAIL(1," & ctr2 & ",FALSE,," & ctr1-1 & ")"

Untested!

And why not declare them as longs?

Dan wrote:

Trying to include the "Hide details" command in a macro but with variables

Dim Ctr1 As Variant
Dim Ctr2 As Variant

Ctr1 = 8
Ctr2 = 23

Rows(Ctr1 & ":" & Ctr2).Select
worksSelection.Rows.Group
ExecuteExcel4Macro "SHOW.DETAIL(1,23,FALSE,,7)" - works

ExecuteExcel4Macro "SHOW.DETAIL(1,Ctr2,FALSE,,Ctr1 - 1)" - does not work
Get a Run-time error '1004' -You've entered too many arguments for this
equation.

Any ideas?


--

Dave Peterson

  #4   Report Post  
Posted to microsoft.public.excel.programming
dan dan is offline
external usenet poster
 
Posts: 866
Default Data - Group - Hide Details

Found a potential solution around the "ExecuteExcel4Macro" error. In place of
hiding the details for each set of data you can use the
"ActiveSheet.Outline.ShowLevels RowLevels:=1" command to hide all details for
all groups.

Still not sure how to hide for specific groups.

Help states:
Remarks
The Microsoft Excel 4.0 macro isn't evaluated in the context of the current
workbook or sheet. This means that any references should be external and
should specify an explicit workbook name. For example, to run the Microsoft
Excel 4.0 macro "My_Macro" in Book1 you must use "Book1!My_Macro()". If you
don't specify the workbook name, this method fails

Not sure on how this applies.

"Dan" wrote:

Now I have more issues. I generated the macro on Excel 2002 (by using the
record command) and replaced the variables myself. As for the Variant vs Long
- no reason just wasn't paying that much attention when I created the
variables to test.

Now running the macro in 2003 generates the same error for both
"ExecuteExcel4Macro" commands (even the one generated by the record command).
Both still do not "hide" the details.


"Dave Peterson" wrote:

How about:

ExecuteExcel4Macro "SHOW.DETAIL(1," & ctr2 & ",FALSE,," & ctr1-1 & ")"

Untested!

And why not declare them as longs?

Dan wrote:

Trying to include the "Hide details" command in a macro but with variables

Dim Ctr1 As Variant
Dim Ctr2 As Variant

Ctr1 = 8
Ctr2 = 23

Rows(Ctr1 & ":" & Ctr2).Select
worksSelection.Rows.Group
ExecuteExcel4Macro "SHOW.DETAIL(1,23,FALSE,,7)" - works

ExecuteExcel4Macro "SHOW.DETAIL(1,Ctr2,FALSE,,Ctr1 - 1)" - does not work
Get a Run-time error '1004' -You've entered too many arguments for this
equation.

Any ideas?


--

Dave Peterson

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Data - Group - Hide Details

It doesn't look like your show.detail line is using the correct syntax.

I opened up the old XL4 help file and found this:

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, if the selection is inside a PivotTable. The new field is added as
the new innermost field. Available for only innermost row or column fields.

You may want to google for show.detail to see some examples.

Dan wrote:

Now I have more issues. I generated the macro on Excel 2002 (by using the
record command) and replaced the variables myself. As for the Variant vs Long
- no reason just wasn't paying that much attention when I created the
variables to test.

Now running the macro in 2003 generates the same error for both
"ExecuteExcel4Macro" commands (even the one generated by the record command).
Both still do not "hide" the details.

"Dave Peterson" wrote:

How about:

ExecuteExcel4Macro "SHOW.DETAIL(1," & ctr2 & ",FALSE,," & ctr1-1 & ")"

Untested!

And why not declare them as longs?

Dan wrote:

Trying to include the "Hide details" command in a macro but with variables

Dim Ctr1 As Variant
Dim Ctr2 As Variant

Ctr1 = 8
Ctr2 = 23

Rows(Ctr1 & ":" & Ctr2).Select
worksSelection.Rows.Group
ExecuteExcel4Macro "SHOW.DETAIL(1,23,FALSE,,7)" - works

ExecuteExcel4Macro "SHOW.DETAIL(1,Ctr2,FALSE,,Ctr1 - 1)" - does not work
Get a Run-time error '1004' -You've entered too many arguments for this
equation.

Any ideas?


--

Dave Peterson


--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.programming
dan dan is offline
external usenet poster
 
Posts: 866
Default Data - Group - Hide Details

Dave,

Thanks for the info. I will look around fo some examples.
Not sure why the syntax would be the problem since it was obtained from the
Record macro function to see how Excel defined it. I just re-ran it and it
failed.

Thanks again for all the help.

"Dave Peterson" wrote:

It doesn't look like your show.detail line is using the correct syntax.

I opened up the old XL4 help file and found this:

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, if the selection is inside a PivotTable. The new field is added as
the new innermost field. Available for only innermost row or column fields.

You may want to google for show.detail to see some examples.

Dan wrote:

Now I have more issues. I generated the macro on Excel 2002 (by using the
record command) and replaced the variables myself. As for the Variant vs Long
- no reason just wasn't paying that much attention when I created the
variables to test.

Now running the macro in 2003 generates the same error for both
"ExecuteExcel4Macro" commands (even the one generated by the record command).
Both still do not "hide" the details.

"Dave Peterson" wrote:

How about:

ExecuteExcel4Macro "SHOW.DETAIL(1," & ctr2 & ",FALSE,," & ctr1-1 & ")"

Untested!

And why not declare them as longs?

Dan wrote:

Trying to include the "Hide details" command in a macro but with variables

Dim Ctr1 As Variant
Dim Ctr2 As Variant

Ctr1 = 8
Ctr2 = 23

Rows(Ctr1 & ":" & Ctr2).Select
worksSelection.Rows.Group
ExecuteExcel4Macro "SHOW.DETAIL(1,23,FALSE,,7)" - works

ExecuteExcel4Macro "SHOW.DETAIL(1,Ctr2,FALSE,,Ctr1 - 1)" - does not work
Get a Run-time error '1004' -You've entered too many arguments for this
equation.

Any ideas?

--

Dave Peterson


--

Dave Peterson

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hide/Show details in an Outline Group JimAA Excel Discussion (Misc queries) 0 November 11th 09 05:56 PM
Hide "Show details" when right click on data field in Pivot Table Anh Tuan Excel Discussion (Misc queries) 0 June 18th 09 07:57 AM
SUBTOTAL'S SHOW AND HIDE DETAILS BUTTON MISSING Seebu Excel Discussion (Misc queries) 4 October 29th 07 02:27 PM
hide / unhide details Chris Sites Excel Programming 4 April 30th 04 04:35 PM
Hide details Paul S Panoff Excel Programming 2 February 19th 04 07:42 PM


All times are GMT +1. The time now is 06:42 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"