Ok this macro I can't find an example of, but what I want to do is pretty simple (i think). Hans helped me fix the macro at the bottom of this post a few minutes ago - works perfectly. With this macro I want to insert another section that sets up a tree view of a list of items I have output from some program. It outputs things in this format:
item
.item
..item
..item
...item
...item
...item
..item
..item
.item
..item
...item
.item
I guess it isn't necessary to put it in the SAME sub, but it would be nice to only have to run 1 macro. Anyway, as you can see the items above follow a number of periods that act as the level of the item next to it. So it is a tree already, its just tough to see it on the sheet in that format and differentiate the items. I'd like to make macro that moves the item X cells to the right, where X = the number of periods in front of the item (X can be = to zero since there may be no periods in front of an item (top level)). Each item and it's periods are in the same cell.
Public Sub Treeview_and_DelBlankRows()
Dim I As Long
Dim J As Long
Dim f As Boolean
For I = Range("A65536").End(xlUp).Row - 1 To 1 Step -1
f = True
For J = 1 To Cells(I, 255).End(xlToLeft).Column
If Trim(Cells(I, J)) <> "" Then
f = False
End If
Next J
If f = True Then
Rows(I).Delete
End If
Next I
End Sub
I'm thinking as it goes through the outter loop, I can put a line in that moves cells to the right, but I don't know how to look for up to 8 possible periods.



