Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Check to see if subtotal is expanded

I've had a quick search and couldn't seem to find anything on this so
hopefully you can help :)

I have a spreadsheet with a number of subtotals with a second tier. I also
have a button to add a new sub task to a tier 1 group. For example:

Task A
Sub Task a.1 value
Sub Task a.2 value

Task B
Sub Task b.1 value
Sub Task b.2 value
Sub Task b.3 value
Sub Task b.4 value

Task C
Sub Task c.1 value

The command button provides a usercontrol which displays the tier 1 tasks
with a blank text box to add a new item. What I need is for some code to
check that the tier 1 task isn't collapsed before it inserts a line and if it
is, to expand it.

Any suggestions please?

Thanks all!

Mav
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Check to see if subtotal is expanded

If you mean to display all outline levels; try the below

Sub Macro4()
Dim lngRow As Long, varOLevel As Variant
For lngRow = 1 To Cells(Rows.Count, "A").End(xlUp).Row
If Rows(lngRow).OutlineLevel varOLevel Then
varOLevel = Rows(lngRow).OutlineLevel
End If
Next
ActiveSheet.Outline.ShowLevels varOLevel
End Sub

--
Jacob (MVP - Excel)


"Maver1ck666" wrote:

I've had a quick search and couldn't seem to find anything on this so
hopefully you can help :)

I have a spreadsheet with a number of subtotals with a second tier. I also
have a button to add a new sub task to a tier 1 group. For example:

Task A
Sub Task a.1 value
Sub Task a.2 value

Task B
Sub Task b.1 value
Sub Task b.2 value
Sub Task b.3 value
Sub Task b.4 value

Task C
Sub Task c.1 value

The command button provides a usercontrol which displays the tier 1 tasks
with a blank text box to add a new item. What I need is for some code to
check that the tier 1 task isn't collapsed before it inserts a line and if it
is, to expand it.

Any suggestions please?

Thanks all!

Mav

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Check to see if subtotal is expanded

Cheers for that Jacob. It kinda works but expands all the lists as opposed to
just the one the cursor is at. Any ideas please?

Mav

"Jacob Skaria" wrote:

If you mean to display all outline levels; try the below

Sub Macro4()
Dim lngRow As Long, varOLevel As Variant
For lngRow = 1 To Cells(Rows.Count, "A").End(xlUp).Row
If Rows(lngRow).OutlineLevel varOLevel Then
varOLevel = Rows(lngRow).OutlineLevel
End If
Next
ActiveSheet.Outline.ShowLevels varOLevel
End Sub

--
Jacob (MVP - Excel)


"Maver1ck666" wrote:

I've had a quick search and couldn't seem to find anything on this so
hopefully you can help :)

I have a spreadsheet with a number of subtotals with a second tier. I also
have a button to add a new sub task to a tier 1 group. For example:

Task A
Sub Task a.1 value
Sub Task a.2 value

Task B
Sub Task b.1 value
Sub Task b.2 value
Sub Task b.3 value
Sub Task b.4 value

Task C
Sub Task c.1 value

The command button provides a usercontrol which displays the tier 1 tasks
with a blank text box to add a new item. What I need is for some code to
check that the tier 1 task isn't collapsed before it inserts a line and if it
is, to expand it.

Any suggestions please?

Thanks all!

Mav

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
toolbar not expanded beverlydawn Excel Discussion (Misc queries) 1 February 19th 09 07:57 PM
Countif expanded brownti via OfficeKB.com Excel Discussion (Misc queries) 3 December 10th 08 05:35 PM
Expanded sumproduct Steven Excel Worksheet Functions 12 October 30th 08 09:56 PM
Subtotal check in Excel 2000 VBA Larry D[_2_] Excel Programming 1 March 22nd 07 10:37 PM
Check for & remove Subtotal(s) josnah[_6_] Excel Programming 1 July 25th 06 02:04 PM


All times are GMT +1. The time now is 02:40 PM.

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

About Us

"It's about Microsoft Excel"