Thema Datum  Von Nutzer Rating
Antwort
07.05.2014 13:28:05 Kira
NotSolved
07.05.2014 13:44:02 Gast21770
NotSolved
07.05.2014 14:24:27 Kira
NotSolved
Blau Just go and try it
07.05.2014 20:37:08 Gast64735
NotSolved
07.05.2014 16:10:31 Gast53754
*
NotSolved
07.05.2014 16:11:02 HalliHallo
*
NotSolved

Ansicht des Beitrags:
Von:
Gast64735
Datum:
07.05.2014 20:37:08
Views:
806
Rating: Antwort:
  Ja
Thema:
Just go and try it
Option Explicit

Sub TryThis()
Dim oWs As Worksheet, oSh As Worksheet
Dim lngRow As Long, lngCol
Dim rngUsed As Range, rngRow As Range, c As Range
Dim oOutline As Outline
Dim lngVisible As Long
Application.ScreenUpdating = False
'
'active sheet with groups
Set oWs = ActiveSheet
'used
lngRow = Cells.Find("*", [a1], , , xlByRows, xlPrevious).Row
lngCol = Cells.Find("*", [a1], , , xlByColumns, xlPrevious).Column
Set rngUsed = Range(Cells(1, 1), Cells(lngRow, lngCol))
'
'chk Outline object
Set oOutline = oWs.Outline
'
'expand
oOutline.ShowLevels rowlevels:=8
lngVisible = rngUsed.Rows.SpecialCells(xlVisible).Count
'
'contract
oOutline.ShowLevels rowlevels:=1
If rngUsed.Rows.SpecialCells(xlVisible).Count = lngVisible Then
  MsgBox "no groups found !"
  oOutline.ShowLevels rowlevels:=8
  Set oOutline = Nothing
  Application.ScreenUpdating = True
  Exit Sub
End If
'
'hidden
For Each rngRow In rngUsed.Rows
  If rngRow.Hidden Then Cells(rngRow.Row, lngCol + 1).Formula = "x"
Next rngRow
'
'new sheet
Sheets.Add After:=Sheets(Sheets.Count)
Set oSh = ActiveSheet
oWs.Activate
'
'expand
oOutline.ShowLevels rowlevels:=8
'
'copy
Set c = oSh.Cells(1, 1)
For Each rngRow In rngUsed.Rows
  If Cells(rngRow.Row, lngCol + 1).Formula <> "x" Then
    rngRow.Copy Destination:=c
    Set c = c.Offset(1, 0)
  End If
Next rngRow
'
'if unwanted "x"
Range(Cells(1, lngCol + 1), Cells(lngRow, lngCol + 1)).Clear

'ready
Set oOutline = Nothing
Application.ScreenUpdating = True
End Sub

 


Ihre Antwort
  • Bitte beschreiben Sie Ihr Problem möglichst ausführlich. (Wichtige Info z.B.: Office Version, Betriebssystem, Wo genau kommen Sie nicht weiter)
  • Bitte helfen Sie ebenfalls wenn Ihnen geholfen werden konnte und markieren Sie Ihre Anfrage als erledigt (Klick auf Häckchen)
  • Bei Crossposting, entsprechende Links auf andere Forenbeiträge beifügen / nachtragen
  • Codeschnipsel am besten über den Code-Button im Text-Editor einfügen
  • Die Angabe der Emailadresse ist freiwillig und wird nur verwendet, um Sie bei Antworten auf Ihren Beitrag zu benachrichtigen
Thema: Name: Email:



  • Bitte beschreiben Sie Ihr Problem möglichst ausführlich. (Wichtige Info z.B.: Office Version, Betriebssystem, Wo genau kommen Sie nicht weiter)
  • Bitte helfen Sie ebenfalls wenn Ihnen geholfen werden konnte und markieren Sie Ihre Anfrage als erledigt (Klick auf Häckchen)
  • Bei Crossposting, entsprechende Links auf andere Forenbeiträge beifügen / nachtragen
  • Codeschnipsel am besten über den Code-Button im Text-Editor einfügen
  • Die Angabe der Emailadresse ist freiwillig und wird nur verwendet, um Sie bei Antworten auf Ihren Beitrag zu benachrichtigen

Thema Datum  Von Nutzer Rating
Antwort
07.05.2014 13:28:05 Kira
NotSolved
07.05.2014 13:44:02 Gast21770
NotSolved
07.05.2014 14:24:27 Kira
NotSolved
Blau Just go and try it
07.05.2014 20:37:08 Gast64735
NotSolved
07.05.2014 16:10:31 Gast53754
*
NotSolved
07.05.2014 16:11:02 HalliHallo
*
NotSolved