PC Review


Reply
Thread Tools Rate Thread

Check to see if subtotal is expanded

 
 
Maver1ck666
Guest
Posts: n/a
 
      29th Apr 2010
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 With Quote
 
 
 
 
Jacob Skaria
Guest
Posts: n/a
 
      29th Apr 2010
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 With Quote
 
Maver1ck666
Guest
Posts: n/a
 
      29th Apr 2010
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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How can I check if a sub form was expanded? Tom van Stiphout Microsoft Access Form Coding 0 5th Feb 2010 02:03 PM
AJAX Treeview How to keep expanded nodes expanded during AJAX postback ton Microsoft ASP .NET 2 10th Dec 2008 04:11 PM
Subtotal check in Excel 2000 VBA Larry D Microsoft Excel Programming 1 22nd Mar 2007 10:37 PM
pasting to subtotal lines without replacing hidden -non-subtotal l =?Utf-8?B?aGFybGV5ZGl2YTY3?= Microsoft Excel Misc 1 12th Oct 2006 06:02 PM
Check for & remove Subtotal(s) josnah Microsoft Excel Programming 1 25th Jul 2006 02:04 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:42 AM.