View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
ryguy7272 ryguy7272 is offline
external usenet poster
 
Posts: 2,836
Default Grouping According to IndentLevel

Yep, I thought of that too. I tried it before I posted the question; didn't
work. Other ideas?

Thanks,
Ryan---


--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"Eric G" wrote:

What object is ".IndentLevel" referring to? Usually, you would have
something like

With ActiveCell
ID = .IndentLevel
End With

or something like that.

HTH,

Eric

"ryguy7272" wrote:

I am trying to arrange elements into groups. My code is below:
Sub Grp()
Dim lngRow As Long

Sheets("Sheet1").Select

For i = 6 To 0 Step -1
For lngRow = Cells(Rows.Count, "B").End(xlUp).Row To 4 Step -1
If Range("B" & lngRow) < "" And .IndentLevel = (i) Then
Range("B" & lngRow & ":B" & lngRow).Rows.Group
End If
Next lngRow
Next i

End Sub

Basically, I want to start on Row 4, go to the end of the used range, and
group all data according to the €˜Indent of each Row. There can be 0 to 6
IndentLevels.
The code fails on this line:
If Range("B" & lngRow) < "" And .IndentLevel = (i) Then

The message I get says €˜Compile Error: Invalid or unqualified refernce.
What am I doing wrong?

Thanks,
Ryan---


--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.