Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub NetsuiteToExcelGroup()
- Dim CurrentLine As Integer
- Dim LastLine As Integer
- Cells.RowHeight = 18.75
- Cells.EntireRow.AutoFit
- LastLine = Cells(999999, 1).End(xlUp).Row
- With ActiveSheet.Outline
- .AutomaticStyles = False
- .SummaryRow = xlAbove
- .SummaryColumn = xlRight
- End With
- i = 1
- Do While Cells(i, 1).Interior.Color <> 13684944
- i = i + 1
- Loop
- i = i + 1
- CurrentLine = i
- Call Group(i, CurrentLine, LastLine)
- End Sub
- Sub Group(ByVal StartLine As Integer, ByRef CurrentLine As Integer, ByRef LastLine As Integer)
- stopper = False
- StartLine = CurrentLine
- Do While stopper = False
- If CurrentLine > LastLine Then
- Exit Do
- End If
- If Cells(CurrentLine, 1).IndentLevel < Cells(CurrentLine + 1, 1).IndentLevel Then
- CurrentLine = CurrentLine + 1
- Call Group(StartLine, CurrentLine, LastLine)
- ElseIf Cells(CurrentLine, 1).IndentLevel = Cells(CurrentLine + 1, 1).IndentLevel Then
- CurrentLine = CurrentLine + 1
- ElseIf Cells(CurrentLine, 1).IndentLevel > Cells(CurrentLine + 1, 1).IndentLevel Then
- Rows(CStr(StartLine) + ":" + CStr(CurrentLine + 1)).Select
- Selection.Rows.Group
- If IsEmpty(Cells(StartLine - 1, 2)) Then
- Cells(StartLine - 1, 2).Formula = Cells(CurrentLine + 1, 2).Formula
- End If
- CurrentLine = CurrentLine + 1
- Exit Do
- Else
- Exit Do
- End If
- Loop
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement