Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default Grouping Question

I am trying to find a way to group rows, according to the following logic:

Start in row 9

Test to see if there are two, or four, blank spaces in a cell, preceding
text. If there are two blank spaces in a cell, move to the next cell. When
a cell has four spaces, group that with the cells above. Move on to test the
next cell.

If a cell is found with no data at all, this is a totally blank cell; offset
one row down, and continue the process, until 2, or maybe 3, blank rows are
in consecutive order.

I have this now:

Sub Grp()
Dim rng As Range
Dim i As Long
Sheets("Sheet1").Select
For i = 9 To Cells(Rows.Count, "B").End(xlUp).Row
If Len(ActiveCell) 0 Then
Rows(i).Group
Else
End If
Next i
End Sub

Thanks so much,
Ryan---


--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Grouping Question

I am not sure whether I understood your post clearly..Please try and feedback

Sub Grp()
Dim lngRow As Long
Sheets("Sheet1").Select
For lngRow = 9 To Cells(Rows.Count, "B").End(xlUp).Row
If Range("B" & lngRow) < "" And Left(Range("B" & lngRow), 4) = Space(4) Then
Range("B" & lngRow - 1 & ":B" & lngRow).Rows.Group
End If
Next lngRow
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"ryguy7272" wrote:

I am trying to find a way to group rows, according to the following logic:

Start in row 9

Test to see if there are two, or four, blank spaces in a cell, preceding
text. If there are two blank spaces in a cell, move to the next cell. When
a cell has four spaces, group that with the cells above. Move on to test the
next cell.

If a cell is found with no data at all, this is a totally blank cell; offset
one row down, and continue the process, until 2, or maybe 3, blank rows are
in consecutive order.

I have this now:

Sub Grp()
Dim rng As Range
Dim i As Long
Sheets("Sheet1").Select
For i = 9 To Cells(Rows.Count, "B").End(xlUp).Row
If Len(ActiveCell) 0 Then
Rows(i).Group
Else
End If
Next i
End Sub

Thanks so much,
Ryan---


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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default Grouping Question

Thanks a lot!!

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


"Jacob Skaria" wrote:

I am not sure whether I understood your post clearly..Please try and feedback

Sub Grp()
Dim lngRow As Long
Sheets("Sheet1").Select
For lngRow = 9 To Cells(Rows.Count, "B").End(xlUp).Row
If Range("B" & lngRow) < "" And Left(Range("B" & lngRow), 4) = Space(4) Then
Range("B" & lngRow - 1 & ":B" & lngRow).Rows.Group
End If
Next lngRow
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"ryguy7272" wrote:

I am trying to find a way to group rows, according to the following logic:

Start in row 9

Test to see if there are two, or four, blank spaces in a cell, preceding
text. If there are two blank spaces in a cell, move to the next cell. When
a cell has four spaces, group that with the cells above. Move on to test the
next cell.

If a cell is found with no data at all, this is a totally blank cell; offset
one row down, and continue the process, until 2, or maybe 3, blank rows are
in consecutive order.

I have this now:

Sub Grp()
Dim rng As Range
Dim i As Long
Sheets("Sheet1").Select
For i = 9 To Cells(Rows.Count, "B").End(xlUp).Row
If Len(ActiveCell) 0 Then
Rows(i).Group
Else
End If
Next i
End Sub

Thanks so much,
Ryan---


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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Question on my Case of grouping the SW Blue Fish[_2_] Excel Worksheet Functions 1 September 5th 09 09:02 AM
simple grouping question Cindy B Excel Worksheet Functions 5 August 9th 08 10:04 PM
Pivot table grouping question Jason[_7_] Excel Worksheet Functions 1 October 5th 07 02:22 PM
Grouping Question Jay Excel Worksheet Functions 0 February 28th 05 05:09 PM
Grouping & Sorting question Stuart[_5_] Excel Programming 4 August 30th 03 06:18 PM


All times are GMT +1. The time now is 09:31 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"