Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,814
Default formatting & programming

is there a code to go through by rows and find when a certain cell border
comes up? For example, if i have rows lumped in groups of three, and each
set of three is seperated by the double line border.

is there a way to tell it to group (Datat--Group) these three together
based on the fact that they are withing this border?

for example, (i would not know how to program this)

search row by row
when it finds the double line, start grouping.
when it finds the double line again, stop that group and start another one

thanks
steve

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default formatting & programming

Try doing this by hand once. You'll may see that all the rows are grouped
together--since there isn't a break between each group.

But this may work for you:

Option Explicit
Sub testme01()

Dim TopCell As Range
Dim BotCell As Range
Dim FirstRow As Long
Dim LastRow As Long
Dim iRow As Long
Dim wks As Worksheet

Set wks = ActiveSheet

With wks
'clean up first.
.Cells.ClearOutline

FirstRow = 2
LastRow = .Cells.SpecialCells(xlCellTypeLastCell).Row

Set TopCell = .Cells(FirstRow, "A")
Set BotCell = TopCell

For iRow = FirstRow + 1 To LastRow
If .Cells(iRow, "A").Borders(xlEdgeBottom).LineStyle _
= xlDouble Then
Set BotCell = .Cells(iRow, "A")
.Range(TopCell.Offset(1, 0), BotCell).Rows.Group
Set TopCell = BotCell.Offset(1, 0)
Set BotCell = TopCell
End If
Next iRow

If BotCell.Row = LastRow Then
'do nothing
Else
.Range(BotCell.Offset(1, 0), .Cells(LastRow, "a")).Rows.Group
End If

End With

End Sub

steve wrote:

is there a code to go through by rows and find when a certain cell border
comes up? For example, if i have rows lumped in groups of three, and each
set of three is seperated by the double line border.

is there a way to tell it to group (Datat--Group) these three together
based on the fact that they are withing this border?

for example, (i would not know how to program this)

search row by row
when it finds the double line, start grouping.
when it finds the double line again, stop that group and start another one

thanks
steve


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,814
Default formatting & programming

that was awesome man, thanks a lot

"Dave Peterson" wrote:

Try doing this by hand once. You'll may see that all the rows are grouped
together--since there isn't a break between each group.

But this may work for you:

Option Explicit
Sub testme01()

Dim TopCell As Range
Dim BotCell As Range
Dim FirstRow As Long
Dim LastRow As Long
Dim iRow As Long
Dim wks As Worksheet

Set wks = ActiveSheet

With wks
'clean up first.
.Cells.ClearOutline

FirstRow = 2
LastRow = .Cells.SpecialCells(xlCellTypeLastCell).Row

Set TopCell = .Cells(FirstRow, "A")
Set BotCell = TopCell

For iRow = FirstRow + 1 To LastRow
If .Cells(iRow, "A").Borders(xlEdgeBottom).LineStyle _
= xlDouble Then
Set BotCell = .Cells(iRow, "A")
.Range(TopCell.Offset(1, 0), BotCell).Rows.Group
Set TopCell = BotCell.Offset(1, 0)
Set BotCell = TopCell
End If
Next iRow

If BotCell.Row = LastRow Then
'do nothing
Else
.Range(BotCell.Offset(1, 0), .Cells(LastRow, "a")).Rows.Group
End If

End With

End Sub

steve wrote:

is there a code to go through by rows and find when a certain cell border
comes up? For example, if i have rows lumped in groups of three, and each
set of three is seperated by the double line border.

is there a way to tell it to group (Datat--Group) these three together
based on the fact that they are withing this border?

for example, (i would not know how to program this)

search row by row
when it finds the double line, start grouping.
when it finds the double line again, stop that group and start another one

thanks
steve


--

Dave Peterson

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,814
Default formatting & programming

going off the code you gave me.....

the grouping part worked perfect. i also have sort buttons with the code
you gave me worked into them. the issue is that the double lines do not
move. i'm working on a way that it places the double line in the rows where
the formulas change. this is because each job has the same formulas in all
its rows.

the reason this is so confusing is because the only way i can keep these
jobs together when i sort is to use helper columns. the helper columns copy
the job name into all the rows for that job, that way they stay together
during sorting.

would it be easier for the code to:

1) go through and distinguish between jobs (based on the change in the
helper columns) then add a double line to break

2) should i just use a space to break up the different jobs, and copy the
formulas into the blank row (to keep the blank row as part of the job)

"steve" wrote:

that was awesome man, thanks a lot

"Dave Peterson" wrote:

Try doing this by hand once. You'll may see that all the rows are grouped
together--since there isn't a break between each group.

But this may work for you:

Option Explicit
Sub testme01()

Dim TopCell As Range
Dim BotCell As Range
Dim FirstRow As Long
Dim LastRow As Long
Dim iRow As Long
Dim wks As Worksheet

Set wks = ActiveSheet

With wks
'clean up first.
.Cells.ClearOutline

FirstRow = 2
LastRow = .Cells.SpecialCells(xlCellTypeLastCell).Row

Set TopCell = .Cells(FirstRow, "A")
Set BotCell = TopCell

For iRow = FirstRow + 1 To LastRow
If .Cells(iRow, "A").Borders(xlEdgeBottom).LineStyle _
= xlDouble Then
Set BotCell = .Cells(iRow, "A")
.Range(TopCell.Offset(1, 0), BotCell).Rows.Group
Set TopCell = BotCell.Offset(1, 0)
Set BotCell = TopCell
End If
Next iRow

If BotCell.Row = LastRow Then
'do nothing
Else
.Range(BotCell.Offset(1, 0), .Cells(LastRow, "a")).Rows.Group
End If

End With

End Sub

steve wrote:

is there a code to go through by rows and find when a certain cell border
comes up? For example, if i have rows lumped in groups of three, and each
set of three is seperated by the double line border.

is there a way to tell it to group (Datat--Group) these three together
based on the fact that they are withing this border?

for example, (i would not know how to program this)

search row by row
when it finds the double line, start grouping.
when it finds the double line again, stop that group and start another one

thanks
steve


--

Dave Peterson

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default formatting & programming

Double lines are just formatting, right?

First thing I would try to do is to put all my data on one row. It makes
sorting much easier.

If I couldn't do that, then I'd use the helper columns (like you did).

But then I'd clear the formatting and reapply it--just add that code to your
sort macro.

I don't like putting extra blank rows in my data.

===
One more option to make reading a little easier. Instead of using double lines,
just double the height of the first row of each group (with alignment at the
bottom). It'll give the look that the group is double spaced.

(you'll have to autofit your rows, sort, then reapply the row height doubling,
too.)

steve wrote:

going off the code you gave me.....

the grouping part worked perfect. i also have sort buttons with the code
you gave me worked into them. the issue is that the double lines do not
move. i'm working on a way that it places the double line in the rows where
the formulas change. this is because each job has the same formulas in all
its rows.

the reason this is so confusing is because the only way i can keep these
jobs together when i sort is to use helper columns. the helper columns copy
the job name into all the rows for that job, that way they stay together
during sorting.

would it be easier for the code to:

1) go through and distinguish between jobs (based on the change in the
helper columns) then add a double line to break

2) should i just use a space to break up the different jobs, and copy the
formulas into the blank row (to keep the blank row as part of the job)

"steve" wrote:

that was awesome man, thanks a lot

"Dave Peterson" wrote:

Try doing this by hand once. You'll may see that all the rows are grouped
together--since there isn't a break between each group.

But this may work for you:

Option Explicit
Sub testme01()

Dim TopCell As Range
Dim BotCell As Range
Dim FirstRow As Long
Dim LastRow As Long
Dim iRow As Long
Dim wks As Worksheet

Set wks = ActiveSheet

With wks
'clean up first.
.Cells.ClearOutline

FirstRow = 2
LastRow = .Cells.SpecialCells(xlCellTypeLastCell).Row

Set TopCell = .Cells(FirstRow, "A")
Set BotCell = TopCell

For iRow = FirstRow + 1 To LastRow
If .Cells(iRow, "A").Borders(xlEdgeBottom).LineStyle _
= xlDouble Then
Set BotCell = .Cells(iRow, "A")
.Range(TopCell.Offset(1, 0), BotCell).Rows.Group
Set TopCell = BotCell.Offset(1, 0)
Set BotCell = TopCell
End If
Next iRow

If BotCell.Row = LastRow Then
'do nothing
Else
.Range(BotCell.Offset(1, 0), .Cells(LastRow, "a")).Rows.Group
End If

End With

End Sub

steve wrote:

is there a code to go through by rows and find when a certain cell border
comes up? For example, if i have rows lumped in groups of three, and each
set of three is seperated by the double line border.

is there a way to tell it to group (Datat--Group) these three together
based on the fact that they are withing this border?

for example, (i would not know how to program this)

search row by row
when it finds the double line, start grouping.
when it finds the double line again, stop that group and start another one

thanks
steve

--

Dave Peterson


--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,814
Default formatting & programming

ok, so working off of the program you gave me befo

let's say i want to stick with the double lines. the code should first
clear the formatting, sort the data, then reapply the double lines, then use
the code you gave me before.

the part i'm stuck on is reapplying the double lines. how do i tell it to
put a double line where it is a new job? along the helper column, each time
the name changes it is a new job. i know i have to do something with this,
but i'm lost on how to apply it. thanks again for all your help.

steve



"Dave Peterson" wrote:

Double lines are just formatting, right?

First thing I would try to do is to put all my data on one row. It makes
sorting much easier.

If I couldn't do that, then I'd use the helper columns (like you did).

But then I'd clear the formatting and reapply it--just add that code to your
sort macro.

I don't like putting extra blank rows in my data.

===
One more option to make reading a little easier. Instead of using double lines,
just double the height of the first row of each group (with alignment at the
bottom). It'll give the look that the group is double spaced.

(you'll have to autofit your rows, sort, then reapply the row height doubling,
too.)

steve wrote:

going off the code you gave me.....

the grouping part worked perfect. i also have sort buttons with the code
you gave me worked into them. the issue is that the double lines do not
move. i'm working on a way that it places the double line in the rows where
the formulas change. this is because each job has the same formulas in all
its rows.

the reason this is so confusing is because the only way i can keep these
jobs together when i sort is to use helper columns. the helper columns copy
the job name into all the rows for that job, that way they stay together
during sorting.

would it be easier for the code to:

1) go through and distinguish between jobs (based on the change in the
helper columns) then add a double line to break

2) should i just use a space to break up the different jobs, and copy the
formulas into the blank row (to keep the blank row as part of the job)

"steve" wrote:

that was awesome man, thanks a lot

"Dave Peterson" wrote:

Try doing this by hand once. You'll may see that all the rows are grouped
together--since there isn't a break between each group.

But this may work for you:

Option Explicit
Sub testme01()

Dim TopCell As Range
Dim BotCell As Range
Dim FirstRow As Long
Dim LastRow As Long
Dim iRow As Long
Dim wks As Worksheet

Set wks = ActiveSheet

With wks
'clean up first.
.Cells.ClearOutline

FirstRow = 2
LastRow = .Cells.SpecialCells(xlCellTypeLastCell).Row

Set TopCell = .Cells(FirstRow, "A")
Set BotCell = TopCell

For iRow = FirstRow + 1 To LastRow
If .Cells(iRow, "A").Borders(xlEdgeBottom).LineStyle _
= xlDouble Then
Set BotCell = .Cells(iRow, "A")
.Range(TopCell.Offset(1, 0), BotCell).Rows.Group
Set TopCell = BotCell.Offset(1, 0)
Set BotCell = TopCell
End If
Next iRow

If BotCell.Row = LastRow Then
'do nothing
Else
.Range(BotCell.Offset(1, 0), .Cells(LastRow, "a")).Rows.Group
End If

End With

End Sub

steve wrote:

is there a code to go through by rows and find when a certain cell border
comes up? For example, if i have rows lumped in groups of three, and each
set of three is seperated by the double line border.

is there a way to tell it to group (Datat--Group) these three together
based on the fact that they are withing this border?

for example, (i would not know how to program this)

search row by row
when it finds the double line, start grouping.
when it finds the double line again, stop that group and start another one

thanks
steve

--

Dave Peterson


--

Dave Peterson

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default formatting & programming

When you start the helper cells are ok?

If yes, you could add the formulas in your code, convert those formulas to
values, then sort. Then starting at the bottom, work your way up that helper
column looking for differences.



steve wrote:

ok, so working off of the program you gave me befo

let's say i want to stick with the double lines. the code should first
clear the formatting, sort the data, then reapply the double lines, then use
the code you gave me before.

the part i'm stuck on is reapplying the double lines. how do i tell it to
put a double line where it is a new job? along the helper column, each time
the name changes it is a new job. i know i have to do something with this,
but i'm lost on how to apply it. thanks again for all your help.

steve

"Dave Peterson" wrote:

Double lines are just formatting, right?

First thing I would try to do is to put all my data on one row. It makes
sorting much easier.

If I couldn't do that, then I'd use the helper columns (like you did).

But then I'd clear the formatting and reapply it--just add that code to your
sort macro.

I don't like putting extra blank rows in my data.

===
One more option to make reading a little easier. Instead of using double lines,
just double the height of the first row of each group (with alignment at the
bottom). It'll give the look that the group is double spaced.

(you'll have to autofit your rows, sort, then reapply the row height doubling,
too.)

steve wrote:

going off the code you gave me.....

the grouping part worked perfect. i also have sort buttons with the code
you gave me worked into them. the issue is that the double lines do not
move. i'm working on a way that it places the double line in the rows where
the formulas change. this is because each job has the same formulas in all
its rows.

the reason this is so confusing is because the only way i can keep these
jobs together when i sort is to use helper columns. the helper columns copy
the job name into all the rows for that job, that way they stay together
during sorting.

would it be easier for the code to:

1) go through and distinguish between jobs (based on the change in the
helper columns) then add a double line to break

2) should i just use a space to break up the different jobs, and copy the
formulas into the blank row (to keep the blank row as part of the job)

"steve" wrote:

that was awesome man, thanks a lot

"Dave Peterson" wrote:

Try doing this by hand once. You'll may see that all the rows are grouped
together--since there isn't a break between each group.

But this may work for you:

Option Explicit
Sub testme01()

Dim TopCell As Range
Dim BotCell As Range
Dim FirstRow As Long
Dim LastRow As Long
Dim iRow As Long
Dim wks As Worksheet

Set wks = ActiveSheet

With wks
'clean up first.
.Cells.ClearOutline

FirstRow = 2
LastRow = .Cells.SpecialCells(xlCellTypeLastCell).Row

Set TopCell = .Cells(FirstRow, "A")
Set BotCell = TopCell

For iRow = FirstRow + 1 To LastRow
If .Cells(iRow, "A").Borders(xlEdgeBottom).LineStyle _
= xlDouble Then
Set BotCell = .Cells(iRow, "A")
.Range(TopCell.Offset(1, 0), BotCell).Rows.Group
Set TopCell = BotCell.Offset(1, 0)
Set BotCell = TopCell
End If
Next iRow

If BotCell.Row = LastRow Then
'do nothing
Else
.Range(BotCell.Offset(1, 0), .Cells(LastRow, "a")).Rows.Group
End If

End With

End Sub

steve wrote:

is there a code to go through by rows and find when a certain cell border
comes up? For example, if i have rows lumped in groups of three, and each
set of three is seperated by the double line border.

is there a way to tell it to group (Datat--Group) these three together
based on the fact that they are withing this border?

for example, (i would not know how to program this)

search row by row
when it finds the double line, start grouping.
when it finds the double line again, stop that group and start another one

thanks
steve

--

Dave Peterson


--

Dave Peterson


--

Dave Peterson
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,814
Default formatting & programming

would you mind giving me a quick example on how to see that the data is
changing. i know i'm a pain, but i'm having trouble writing this thing
thanks

"Dave Peterson" wrote:

When you start the helper cells are ok?

If yes, you could add the formulas in your code, convert those formulas to
values, then sort. Then starting at the bottom, work your way up that helper
column looking for differences.



steve wrote:

ok, so working off of the program you gave me befo

let's say i want to stick with the double lines. the code should first
clear the formatting, sort the data, then reapply the double lines, then use
the code you gave me before.

the part i'm stuck on is reapplying the double lines. how do i tell it to
put a double line where it is a new job? along the helper column, each time
the name changes it is a new job. i know i have to do something with this,
but i'm lost on how to apply it. thanks again for all your help.

steve

"Dave Peterson" wrote:

Double lines are just formatting, right?

First thing I would try to do is to put all my data on one row. It makes
sorting much easier.

If I couldn't do that, then I'd use the helper columns (like you did).

But then I'd clear the formatting and reapply it--just add that code to your
sort macro.

I don't like putting extra blank rows in my data.

===
One more option to make reading a little easier. Instead of using double lines,
just double the height of the first row of each group (with alignment at the
bottom). It'll give the look that the group is double spaced.

(you'll have to autofit your rows, sort, then reapply the row height doubling,
too.)

steve wrote:

going off the code you gave me.....

the grouping part worked perfect. i also have sort buttons with the code
you gave me worked into them. the issue is that the double lines do not
move. i'm working on a way that it places the double line in the rows where
the formulas change. this is because each job has the same formulas in all
its rows.

the reason this is so confusing is because the only way i can keep these
jobs together when i sort is to use helper columns. the helper columns copy
the job name into all the rows for that job, that way they stay together
during sorting.

would it be easier for the code to:

1) go through and distinguish between jobs (based on the change in the
helper columns) then add a double line to break

2) should i just use a space to break up the different jobs, and copy the
formulas into the blank row (to keep the blank row as part of the job)

"steve" wrote:

that was awesome man, thanks a lot

"Dave Peterson" wrote:

Try doing this by hand once. You'll may see that all the rows are grouped
together--since there isn't a break between each group.

But this may work for you:

Option Explicit
Sub testme01()

Dim TopCell As Range
Dim BotCell As Range
Dim FirstRow As Long
Dim LastRow As Long
Dim iRow As Long
Dim wks As Worksheet

Set wks = ActiveSheet

With wks
'clean up first.
.Cells.ClearOutline

FirstRow = 2
LastRow = .Cells.SpecialCells(xlCellTypeLastCell).Row

Set TopCell = .Cells(FirstRow, "A")
Set BotCell = TopCell

For iRow = FirstRow + 1 To LastRow
If .Cells(iRow, "A").Borders(xlEdgeBottom).LineStyle _
= xlDouble Then
Set BotCell = .Cells(iRow, "A")
.Range(TopCell.Offset(1, 0), BotCell).Rows.Group
Set TopCell = BotCell.Offset(1, 0)
Set BotCell = TopCell
End If
Next iRow

If BotCell.Row = LastRow Then
'do nothing
Else
.Range(BotCell.Offset(1, 0), .Cells(LastRow, "a")).Rows.Group
End If

End With

End Sub

steve wrote:

is there a code to go through by rows and find when a certain cell border
comes up? For example, if i have rows lumped in groups of three, and each
set of three is seperated by the double line border.

is there a way to tell it to group (Datat--Group) these three together
based on the fact that they are withing this border?

for example, (i would not know how to program this)

search row by row
when it finds the double line, start grouping.
when it finds the double line again, stop that group and start another one

thanks
steve

--

Dave Peterson


--

Dave Peterson


--

Dave Peterson

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default formatting & programming

I don't understand your question.

But if you know your formula and the range it goes, maybe something like this
will be enough.

dim LastRow as long
dim myFormula as string
myformula = "=whateveryouusedintheworksheet"
with activesheet
lastrow = .cells(.rows.count,"A").end(xlup).row
with .range("g2:g"&lastrow)
.formula = myformula
.value = .value
end with
'do the sort
'remove the formatting
'reapply the formatting
end with

(Am I close???)


steve wrote:

would you mind giving me a quick example on how to see that the data is
changing. i know i'm a pain, but i'm having trouble writing this thing
thanks

"Dave Peterson" wrote:

When you start the helper cells are ok?

If yes, you could add the formulas in your code, convert those formulas to
values, then sort. Then starting at the bottom, work your way up that helper
column looking for differences.



steve wrote:

ok, so working off of the program you gave me befo

let's say i want to stick with the double lines. the code should first
clear the formatting, sort the data, then reapply the double lines, then use
the code you gave me before.

the part i'm stuck on is reapplying the double lines. how do i tell it to
put a double line where it is a new job? along the helper column, each time
the name changes it is a new job. i know i have to do something with this,
but i'm lost on how to apply it. thanks again for all your help.

steve

"Dave Peterson" wrote:

Double lines are just formatting, right?

First thing I would try to do is to put all my data on one row. It makes
sorting much easier.

If I couldn't do that, then I'd use the helper columns (like you did).

But then I'd clear the formatting and reapply it--just add that code to your
sort macro.

I don't like putting extra blank rows in my data.

===
One more option to make reading a little easier. Instead of using double lines,
just double the height of the first row of each group (with alignment at the
bottom). It'll give the look that the group is double spaced.

(you'll have to autofit your rows, sort, then reapply the row height doubling,
too.)

steve wrote:

going off the code you gave me.....

the grouping part worked perfect. i also have sort buttons with the code
you gave me worked into them. the issue is that the double lines do not
move. i'm working on a way that it places the double line in the rows where
the formulas change. this is because each job has the same formulas in all
its rows.

the reason this is so confusing is because the only way i can keep these
jobs together when i sort is to use helper columns. the helper columns copy
the job name into all the rows for that job, that way they stay together
during sorting.

would it be easier for the code to:

1) go through and distinguish between jobs (based on the change in the
helper columns) then add a double line to break

2) should i just use a space to break up the different jobs, and copy the
formulas into the blank row (to keep the blank row as part of the job)

"steve" wrote:

that was awesome man, thanks a lot

"Dave Peterson" wrote:

Try doing this by hand once. You'll may see that all the rows are grouped
together--since there isn't a break between each group.

But this may work for you:

Option Explicit
Sub testme01()

Dim TopCell As Range
Dim BotCell As Range
Dim FirstRow As Long
Dim LastRow As Long
Dim iRow As Long
Dim wks As Worksheet

Set wks = ActiveSheet

With wks
'clean up first.
.Cells.ClearOutline

FirstRow = 2
LastRow = .Cells.SpecialCells(xlCellTypeLastCell).Row

Set TopCell = .Cells(FirstRow, "A")
Set BotCell = TopCell

For iRow = FirstRow + 1 To LastRow
If .Cells(iRow, "A").Borders(xlEdgeBottom).LineStyle _
= xlDouble Then
Set BotCell = .Cells(iRow, "A")
.Range(TopCell.Offset(1, 0), BotCell).Rows.Group
Set TopCell = BotCell.Offset(1, 0)
Set BotCell = TopCell
End If
Next iRow

If BotCell.Row = LastRow Then
'do nothing
Else
.Range(BotCell.Offset(1, 0), .Cells(LastRow, "a")).Rows.Group
End If

End With

End Sub

steve wrote:

is there a code to go through by rows and find when a certain cell border
comes up? For example, if i have rows lumped in groups of three, and each
set of three is seperated by the double line border.

is there a way to tell it to group (Datat--Group) these three together
based on the fact that they are withing this border?

for example, (i would not know how to program this)

search row by row
when it finds the double line, start grouping.
when it finds the double line again, stop that group and start another one

thanks
steve

--

Dave Peterson


--

Dave Peterson


--

Dave Peterson


--

Dave Peterson
  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,814
Default formatting & programming

rather than use the formulas, we can just use the values in the cells. after
these values change, i want to add a double line. for example, if the job
name was Wawa:

Wawa
Wawa
Wawa

that would appear in the helper column. so it should go through that, and
when the value changes from let's say Wawa to Walgreens, it adds a double
line between them. so my question is, how do i go through the helper column
and add double lines when the value changes? also, they need to be cleared
and reapplied each time the sort button is hit.

thanks a lot for your help man, i appreciate it
steve

"Dave Peterson" wrote:

I don't understand your question.

But if you know your formula and the range it goes, maybe something like this
will be enough.

dim LastRow as long
dim myFormula as string
myformula = "=whateveryouusedintheworksheet"
with activesheet
lastrow = .cells(.rows.count,"A").end(xlup).row
with .range("g2:g"&lastrow)
.formula = myformula
.value = .value
end with
'do the sort
'remove the formatting
'reapply the formatting
end with

(Am I close???)


steve wrote:

would you mind giving me a quick example on how to see that the data is
changing. i know i'm a pain, but i'm having trouble writing this thing
thanks

"Dave Peterson" wrote:

When you start the helper cells are ok?

If yes, you could add the formulas in your code, convert those formulas to
values, then sort. Then starting at the bottom, work your way up that helper
column looking for differences.



steve wrote:

ok, so working off of the program you gave me befo

let's say i want to stick with the double lines. the code should first
clear the formatting, sort the data, then reapply the double lines, then use
the code you gave me before.

the part i'm stuck on is reapplying the double lines. how do i tell it to
put a double line where it is a new job? along the helper column, each time
the name changes it is a new job. i know i have to do something with this,
but i'm lost on how to apply it. thanks again for all your help.

steve

"Dave Peterson" wrote:

Double lines are just formatting, right?

First thing I would try to do is to put all my data on one row. It makes
sorting much easier.

If I couldn't do that, then I'd use the helper columns (like you did).

But then I'd clear the formatting and reapply it--just add that code to your
sort macro.

I don't like putting extra blank rows in my data.

===
One more option to make reading a little easier. Instead of using double lines,
just double the height of the first row of each group (with alignment at the
bottom). It'll give the look that the group is double spaced.

(you'll have to autofit your rows, sort, then reapply the row height doubling,
too.)

steve wrote:

going off the code you gave me.....

the grouping part worked perfect. i also have sort buttons with the code
you gave me worked into them. the issue is that the double lines do not
move. i'm working on a way that it places the double line in the rows where
the formulas change. this is because each job has the same formulas in all
its rows.

the reason this is so confusing is because the only way i can keep these
jobs together when i sort is to use helper columns. the helper columns copy
the job name into all the rows for that job, that way they stay together
during sorting.

would it be easier for the code to:

1) go through and distinguish between jobs (based on the change in the
helper columns) then add a double line to break

2) should i just use a space to break up the different jobs, and copy the
formulas into the blank row (to keep the blank row as part of the job)

"steve" wrote:

that was awesome man, thanks a lot

"Dave Peterson" wrote:

Try doing this by hand once. You'll may see that all the rows are grouped
together--since there isn't a break between each group.

But this may work for you:

Option Explicit
Sub testme01()

Dim TopCell As Range
Dim BotCell As Range
Dim FirstRow As Long
Dim LastRow As Long
Dim iRow As Long
Dim wks As Worksheet

Set wks = ActiveSheet

With wks
'clean up first.
.Cells.ClearOutline

FirstRow = 2
LastRow = .Cells.SpecialCells(xlCellTypeLastCell).Row

Set TopCell = .Cells(FirstRow, "A")
Set BotCell = TopCell

For iRow = FirstRow + 1 To LastRow
If .Cells(iRow, "A").Borders(xlEdgeBottom).LineStyle _
= xlDouble Then
Set BotCell = .Cells(iRow, "A")
.Range(TopCell.Offset(1, 0), BotCell).Rows.Group
Set TopCell = BotCell.Offset(1, 0)
Set BotCell = TopCell
End If
Next iRow

If BotCell.Row = LastRow Then
'do nothing
Else
.Range(BotCell.Offset(1, 0), .Cells(LastRow, "a")).Rows.Group
End If

End With

End Sub

steve wrote:

is there a code to go through by rows and find when a certain cell border
comes up? For example, if i have rows lumped in groups of three, and each
set of three is seperated by the double line border.

is there a way to tell it to group (Datat--Group) these three together
based on the fact that they are withing this border?

for example, (i would not know how to program this)

search row by row
when it finds the double line, start grouping.
when it finds the double line again, stop that group and start another one

thanks
steve

--

Dave Peterson


--

Dave Peterson


--

Dave Peterson


--

Dave Peterson



  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default formatting & programming

One way:

Option Explicit
Sub testme()

Dim FirstRow As Long
Dim LastRow As Long
Dim iRow As Long
Dim wks As Worksheet
Dim HelperColumn As Long
Dim ColsToUnderline As Long

Set wks = Worksheets("Sheet1")
ColsToUnderline = 12

With wks
HelperColumn = .Range("a1").Column
With .Cells
.Borders(xlEdgeTop).LineStyle = xlNone
.Borders(xlEdgeBottom).LineStyle = xlNone
End With

FirstRow = 2 'headers in row 1???
LastRow = .Cells(.Rows.Count, HelperColumn).End(xlUp).Row

For iRow = LastRow + 1 To FirstRow + 1 Step -1
If .Cells(iRow, HelperColumn).Value _
= .Cells(iRow - 1, HelperColumn).Value Then
'do nothing, same value
Else
With .Cells(iRow, 1).Resize(1, ColsToUnderline) _
.Borders(xlEdgeTop)
.LineStyle = xlDouble
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
End If
Next iRow
End With

End Sub

I worked from the bottom up. But it isn't necessary for this kind of
formatting. But if you ever decide to use the same technique to remove rows,
starting from the bottom makes life much easier.

steve wrote:

rather than use the formulas, we can just use the values in the cells. after
these values change, i want to add a double line. for example, if the job
name was Wawa:

Wawa
Wawa
Wawa

that would appear in the helper column. so it should go through that, and
when the value changes from let's say Wawa to Walgreens, it adds a double
line between them. so my question is, how do i go through the helper column
and add double lines when the value changes? also, they need to be cleared
and reapplied each time the sort button is hit.

thanks a lot for your help man, i appreciate it
steve

"Dave Peterson" wrote:

I don't understand your question.

But if you know your formula and the range it goes, maybe something like this
will be enough.

dim LastRow as long
dim myFormula as string
myformula = "=whateveryouusedintheworksheet"
with activesheet
lastrow = .cells(.rows.count,"A").end(xlup).row
with .range("g2:g"&lastrow)
.formula = myformula
.value = .value
end with
'do the sort
'remove the formatting
'reapply the formatting
end with

(Am I close???)


steve wrote:

would you mind giving me a quick example on how to see that the data is
changing. i know i'm a pain, but i'm having trouble writing this thing
thanks

"Dave Peterson" wrote:

When you start the helper cells are ok?

If yes, you could add the formulas in your code, convert those formulas to
values, then sort. Then starting at the bottom, work your way up that helper
column looking for differences.



steve wrote:

ok, so working off of the program you gave me befo

let's say i want to stick with the double lines. the code should first
clear the formatting, sort the data, then reapply the double lines, then use
the code you gave me before.

the part i'm stuck on is reapplying the double lines. how do i tell it to
put a double line where it is a new job? along the helper column, each time
the name changes it is a new job. i know i have to do something with this,
but i'm lost on how to apply it. thanks again for all your help.

steve

"Dave Peterson" wrote:

Double lines are just formatting, right?

First thing I would try to do is to put all my data on one row. It makes
sorting much easier.

If I couldn't do that, then I'd use the helper columns (like you did).

But then I'd clear the formatting and reapply it--just add that code to your
sort macro.

I don't like putting extra blank rows in my data.

===
One more option to make reading a little easier. Instead of using double lines,
just double the height of the first row of each group (with alignment at the
bottom). It'll give the look that the group is double spaced.

(you'll have to autofit your rows, sort, then reapply the row height doubling,
too.)

steve wrote:

going off the code you gave me.....

the grouping part worked perfect. i also have sort buttons with the code
you gave me worked into them. the issue is that the double lines do not
move. i'm working on a way that it places the double line in the rows where
the formulas change. this is because each job has the same formulas in all
its rows.

the reason this is so confusing is because the only way i can keep these
jobs together when i sort is to use helper columns. the helper columns copy
the job name into all the rows for that job, that way they stay together
during sorting.

would it be easier for the code to:

1) go through and distinguish between jobs (based on the change in the
helper columns) then add a double line to break

2) should i just use a space to break up the different jobs, and copy the
formulas into the blank row (to keep the blank row as part of the job)

"steve" wrote:

that was awesome man, thanks a lot

"Dave Peterson" wrote:

Try doing this by hand once. You'll may see that all the rows are grouped
together--since there isn't a break between each group.

But this may work for you:

Option Explicit
Sub testme01()

Dim TopCell As Range
Dim BotCell As Range
Dim FirstRow As Long
Dim LastRow As Long
Dim iRow As Long
Dim wks As Worksheet

Set wks = ActiveSheet

With wks
'clean up first.
.Cells.ClearOutline

FirstRow = 2
LastRow = .Cells.SpecialCells(xlCellTypeLastCell).Row

Set TopCell = .Cells(FirstRow, "A")
Set BotCell = TopCell

For iRow = FirstRow + 1 To LastRow
If .Cells(iRow, "A").Borders(xlEdgeBottom).LineStyle _
= xlDouble Then
Set BotCell = .Cells(iRow, "A")
.Range(TopCell.Offset(1, 0), BotCell).Rows.Group
Set TopCell = BotCell.Offset(1, 0)
Set BotCell = TopCell
End If
Next iRow

If BotCell.Row = LastRow Then
'do nothing
Else
.Range(BotCell.Offset(1, 0), .Cells(LastRow, "a")).Rows.Group
End If

End With

End Sub

steve wrote:

is there a code to go through by rows and find when a certain cell border
comes up? For example, if i have rows lumped in groups of three, and each
set of three is seperated by the double line border.

is there a way to tell it to group (Datat--Group) these three together
based on the fact that they are withing this border?

for example, (i would not know how to program this)

search row by row
when it finds the double line, start grouping.
when it finds the double line again, stop that group and start another one

thanks
steve

--

Dave Peterson


--

Dave Peterson


--

Dave Peterson


--

Dave Peterson


--

Dave Peterson
  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,814
Default formatting & programming

you're sick...haha
thanks man, that worked nice.

steve

is it cool if i keep this string going if i have questions later? or should
i start a new one??

"Dave Peterson" wrote:

One way:

Option Explicit
Sub testme()

Dim FirstRow As Long
Dim LastRow As Long
Dim iRow As Long
Dim wks As Worksheet
Dim HelperColumn As Long
Dim ColsToUnderline As Long

Set wks = Worksheets("Sheet1")
ColsToUnderline = 12

With wks
HelperColumn = .Range("a1").Column
With .Cells
.Borders(xlEdgeTop).LineStyle = xlNone
.Borders(xlEdgeBottom).LineStyle = xlNone
End With

FirstRow = 2 'headers in row 1???
LastRow = .Cells(.Rows.Count, HelperColumn).End(xlUp).Row

For iRow = LastRow + 1 To FirstRow + 1 Step -1
If .Cells(iRow, HelperColumn).Value _
= .Cells(iRow - 1, HelperColumn).Value Then
'do nothing, same value
Else
With .Cells(iRow, 1).Resize(1, ColsToUnderline) _
.Borders(xlEdgeTop)
.LineStyle = xlDouble
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
End If
Next iRow
End With

End Sub

I worked from the bottom up. But it isn't necessary for this kind of
formatting. But if you ever decide to use the same technique to remove rows,
starting from the bottom makes life much easier.

steve wrote:

rather than use the formulas, we can just use the values in the cells. after
these values change, i want to add a double line. for example, if the job
name was Wawa:

Wawa
Wawa
Wawa

that would appear in the helper column. so it should go through that, and
when the value changes from let's say Wawa to Walgreens, it adds a double
line between them. so my question is, how do i go through the helper column
and add double lines when the value changes? also, they need to be cleared
and reapplied each time the sort button is hit.

thanks a lot for your help man, i appreciate it
steve

"Dave Peterson" wrote:

I don't understand your question.

But if you know your formula and the range it goes, maybe something like this
will be enough.

dim LastRow as long
dim myFormula as string
myformula = "=whateveryouusedintheworksheet"
with activesheet
lastrow = .cells(.rows.count,"A").end(xlup).row
with .range("g2:g"&lastrow)
.formula = myformula
.value = .value
end with
'do the sort
'remove the formatting
'reapply the formatting
end with

(Am I close???)


steve wrote:

would you mind giving me a quick example on how to see that the data is
changing. i know i'm a pain, but i'm having trouble writing this thing
thanks

"Dave Peterson" wrote:

When you start the helper cells are ok?

If yes, you could add the formulas in your code, convert those formulas to
values, then sort. Then starting at the bottom, work your way up that helper
column looking for differences.



steve wrote:

ok, so working off of the program you gave me befo

let's say i want to stick with the double lines. the code should first
clear the formatting, sort the data, then reapply the double lines, then use
the code you gave me before.

the part i'm stuck on is reapplying the double lines. how do i tell it to
put a double line where it is a new job? along the helper column, each time
the name changes it is a new job. i know i have to do something with this,
but i'm lost on how to apply it. thanks again for all your help.

steve

"Dave Peterson" wrote:

Double lines are just formatting, right?

First thing I would try to do is to put all my data on one row. It makes
sorting much easier.

If I couldn't do that, then I'd use the helper columns (like you did).

But then I'd clear the formatting and reapply it--just add that code to your
sort macro.

I don't like putting extra blank rows in my data.

===
One more option to make reading a little easier. Instead of using double lines,
just double the height of the first row of each group (with alignment at the
bottom). It'll give the look that the group is double spaced.

(you'll have to autofit your rows, sort, then reapply the row height doubling,
too.)

steve wrote:

going off the code you gave me.....

the grouping part worked perfect. i also have sort buttons with the code
you gave me worked into them. the issue is that the double lines do not
move. i'm working on a way that it places the double line in the rows where
the formulas change. this is because each job has the same formulas in all
its rows.

the reason this is so confusing is because the only way i can keep these
jobs together when i sort is to use helper columns. the helper columns copy
the job name into all the rows for that job, that way they stay together
during sorting.

would it be easier for the code to:

1) go through and distinguish between jobs (based on the change in the
helper columns) then add a double line to break

2) should i just use a space to break up the different jobs, and copy the
formulas into the blank row (to keep the blank row as part of the job)

"steve" wrote:

that was awesome man, thanks a lot

"Dave Peterson" wrote:

Try doing this by hand once. You'll may see that all the rows are grouped
together--since there isn't a break between each group.

But this may work for you:

Option Explicit
Sub testme01()

Dim TopCell As Range
Dim BotCell As Range
Dim FirstRow As Long
Dim LastRow As Long
Dim iRow As Long
Dim wks As Worksheet

Set wks = ActiveSheet

With wks
'clean up first.
.Cells.ClearOutline

FirstRow = 2
LastRow = .Cells.SpecialCells(xlCellTypeLastCell).Row

Set TopCell = .Cells(FirstRow, "A")
Set BotCell = TopCell

For iRow = FirstRow + 1 To LastRow
If .Cells(iRow, "A").Borders(xlEdgeBottom).LineStyle _
= xlDouble Then
Set BotCell = .Cells(iRow, "A")
.Range(TopCell.Offset(1, 0), BotCell).Rows.Group
Set TopCell = BotCell.Offset(1, 0)
Set BotCell = TopCell
End If
Next iRow

If BotCell.Row = LastRow Then
'do nothing
Else
.Range(BotCell.Offset(1, 0), .Cells(LastRow, "a")).Rows.Group
End If

End With

End Sub

steve wrote:

is there a code to go through by rows and find when a certain cell border
comes up? For example, if i have rows lumped in groups of three, and each
set of three is seperated by the double line border.

is there a way to tell it to group (Datat--Group) these three together
based on the fact that they are withing this border?

for example, (i would not know how to program this)

search row by row
when it finds the double line, start grouping.
when it finds the double line again, stop that group and start another one

thanks
steve

--

Dave Peterson


--

Dave Peterson


--

Dave Peterson


--

Dave Peterson


--

Dave Peterson

  #13   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default formatting & programming

If it's a new subject, start a new thread.

If it's a longgggggggg time between posts, start a new thread, but give enough
info to explain what you've tried.

If it's a short time and it's about this subject, stay here.



steve wrote:

you're sick...haha
thanks man, that worked nice.

steve

is it cool if i keep this string going if i have questions later? or should
i start a new one??

"Dave Peterson" wrote:

One way:

Option Explicit
Sub testme()

Dim FirstRow As Long
Dim LastRow As Long
Dim iRow As Long
Dim wks As Worksheet
Dim HelperColumn As Long
Dim ColsToUnderline As Long

Set wks = Worksheets("Sheet1")
ColsToUnderline = 12

With wks
HelperColumn = .Range("a1").Column
With .Cells
.Borders(xlEdgeTop).LineStyle = xlNone
.Borders(xlEdgeBottom).LineStyle = xlNone
End With

FirstRow = 2 'headers in row 1???
LastRow = .Cells(.Rows.Count, HelperColumn).End(xlUp).Row

For iRow = LastRow + 1 To FirstRow + 1 Step -1
If .Cells(iRow, HelperColumn).Value _
= .Cells(iRow - 1, HelperColumn).Value Then
'do nothing, same value
Else
With .Cells(iRow, 1).Resize(1, ColsToUnderline) _
.Borders(xlEdgeTop)
.LineStyle = xlDouble
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
End If
Next iRow
End With

End Sub

I worked from the bottom up. But it isn't necessary for this kind of
formatting. But if you ever decide to use the same technique to remove rows,
starting from the bottom makes life much easier.

steve wrote:

rather than use the formulas, we can just use the values in the cells. after
these values change, i want to add a double line. for example, if the job
name was Wawa:

Wawa
Wawa
Wawa

that would appear in the helper column. so it should go through that, and
when the value changes from let's say Wawa to Walgreens, it adds a double
line between them. so my question is, how do i go through the helper column
and add double lines when the value changes? also, they need to be cleared
and reapplied each time the sort button is hit.

thanks a lot for your help man, i appreciate it
steve

"Dave Peterson" wrote:

I don't understand your question.

But if you know your formula and the range it goes, maybe something like this
will be enough.

dim LastRow as long
dim myFormula as string
myformula = "=whateveryouusedintheworksheet"
with activesheet
lastrow = .cells(.rows.count,"A").end(xlup).row
with .range("g2:g"&lastrow)
.formula = myformula
.value = .value
end with
'do the sort
'remove the formatting
'reapply the formatting
end with

(Am I close???)


steve wrote:

would you mind giving me a quick example on how to see that the data is
changing. i know i'm a pain, but i'm having trouble writing this thing
thanks

"Dave Peterson" wrote:

When you start the helper cells are ok?

If yes, you could add the formulas in your code, convert those formulas to
values, then sort. Then starting at the bottom, work your way up that helper
column looking for differences.



steve wrote:

ok, so working off of the program you gave me befo

let's say i want to stick with the double lines. the code should first
clear the formatting, sort the data, then reapply the double lines, then use
the code you gave me before.

the part i'm stuck on is reapplying the double lines. how do i tell it to
put a double line where it is a new job? along the helper column, each time
the name changes it is a new job. i know i have to do something with this,
but i'm lost on how to apply it. thanks again for all your help.

steve

"Dave Peterson" wrote:

Double lines are just formatting, right?

First thing I would try to do is to put all my data on one row. It makes
sorting much easier.

If I couldn't do that, then I'd use the helper columns (like you did).

But then I'd clear the formatting and reapply it--just add that code to your
sort macro.

I don't like putting extra blank rows in my data.

===
One more option to make reading a little easier. Instead of using double lines,
just double the height of the first row of each group (with alignment at the
bottom). It'll give the look that the group is double spaced.

(you'll have to autofit your rows, sort, then reapply the row height doubling,
too.)

steve wrote:

going off the code you gave me.....

the grouping part worked perfect. i also have sort buttons with the code
you gave me worked into them. the issue is that the double lines do not
move. i'm working on a way that it places the double line in the rows where
the formulas change. this is because each job has the same formulas in all
its rows.

the reason this is so confusing is because the only way i can keep these
jobs together when i sort is to use helper columns. the helper columns copy
the job name into all the rows for that job, that way they stay together
during sorting.

would it be easier for the code to:

1) go through and distinguish between jobs (based on the change in the
helper columns) then add a double line to break

2) should i just use a space to break up the different jobs, and copy the
formulas into the blank row (to keep the blank row as part of the job)

"steve" wrote:

that was awesome man, thanks a lot

"Dave Peterson" wrote:

Try doing this by hand once. You'll may see that all the rows are grouped
together--since there isn't a break between each group.

But this may work for you:

Option Explicit
Sub testme01()

Dim TopCell As Range
Dim BotCell As Range
Dim FirstRow As Long
Dim LastRow As Long
Dim iRow As Long
Dim wks As Worksheet

Set wks = ActiveSheet

With wks
'clean up first.
.Cells.ClearOutline

FirstRow = 2
LastRow = .Cells.SpecialCells(xlCellTypeLastCell).Row

Set TopCell = .Cells(FirstRow, "A")
Set BotCell = TopCell

For iRow = FirstRow + 1 To LastRow
If .Cells(iRow, "A").Borders(xlEdgeBottom).LineStyle _
= xlDouble Then
Set BotCell = .Cells(iRow, "A")
.Range(TopCell.Offset(1, 0), BotCell).Rows.Group
Set TopCell = BotCell.Offset(1, 0)
Set BotCell = TopCell
End If
Next iRow

If BotCell.Row = LastRow Then
'do nothing
Else
.Range(BotCell.Offset(1, 0), .Cells(LastRow, "a")).Rows.Group
End If

End With

End Sub

steve wrote:

is there a code to go through by rows and find when a certain cell border
comes up? For example, if i have rows lumped in groups of three, and each
set of three is seperated by the double line border.

is there a way to tell it to group (Datat--Group) these three together
based on the fact that they are withing this border?

for example, (i would not know how to program this)

search row by row
when it finds the double line, start grouping.
when it finds the double line again, stop that group and start another one

thanks
steve

--

Dave Peterson


--

Dave Peterson


--

Dave Peterson


--

Dave Peterson


--

Dave Peterson


--

Dave Peterson
  #14   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,814
Default formatting & programming

how come when you sort, all of the formatting follows where the data goes,
except for the borders? the borders do not move? why is this?

"Dave Peterson" wrote:

If it's a new subject, start a new thread.

If it's a longgggggggg time between posts, start a new thread, but give enough
info to explain what you've tried.

If it's a short time and it's about this subject, stay here.



steve wrote:

you're sick...haha
thanks man, that worked nice.

steve

is it cool if i keep this string going if i have questions later? or should
i start a new one??

"Dave Peterson" wrote:

One way:

Option Explicit
Sub testme()

Dim FirstRow As Long
Dim LastRow As Long
Dim iRow As Long
Dim wks As Worksheet
Dim HelperColumn As Long
Dim ColsToUnderline As Long

Set wks = Worksheets("Sheet1")
ColsToUnderline = 12

With wks
HelperColumn = .Range("a1").Column
With .Cells
.Borders(xlEdgeTop).LineStyle = xlNone
.Borders(xlEdgeBottom).LineStyle = xlNone
End With

FirstRow = 2 'headers in row 1???
LastRow = .Cells(.Rows.Count, HelperColumn).End(xlUp).Row

For iRow = LastRow + 1 To FirstRow + 1 Step -1
If .Cells(iRow, HelperColumn).Value _
= .Cells(iRow - 1, HelperColumn).Value Then
'do nothing, same value
Else
With .Cells(iRow, 1).Resize(1, ColsToUnderline) _
.Borders(xlEdgeTop)
.LineStyle = xlDouble
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
End If
Next iRow
End With

End Sub

I worked from the bottom up. But it isn't necessary for this kind of
formatting. But if you ever decide to use the same technique to remove rows,
starting from the bottom makes life much easier.

steve wrote:

rather than use the formulas, we can just use the values in the cells. after
these values change, i want to add a double line. for example, if the job
name was Wawa:

Wawa
Wawa
Wawa

that would appear in the helper column. so it should go through that, and
when the value changes from let's say Wawa to Walgreens, it adds a double
line between them. so my question is, how do i go through the helper column
and add double lines when the value changes? also, they need to be cleared
and reapplied each time the sort button is hit.

thanks a lot for your help man, i appreciate it
steve

"Dave Peterson" wrote:

I don't understand your question.

But if you know your formula and the range it goes, maybe something like this
will be enough.

dim LastRow as long
dim myFormula as string
myformula = "=whateveryouusedintheworksheet"
with activesheet
lastrow = .cells(.rows.count,"A").end(xlup).row
with .range("g2:g"&lastrow)
.formula = myformula
.value = .value
end with
'do the sort
'remove the formatting
'reapply the formatting
end with

(Am I close???)


steve wrote:

would you mind giving me a quick example on how to see that the data is
changing. i know i'm a pain, but i'm having trouble writing this thing
thanks

"Dave Peterson" wrote:

When you start the helper cells are ok?

If yes, you could add the formulas in your code, convert those formulas to
values, then sort. Then starting at the bottom, work your way up that helper
column looking for differences.



steve wrote:

ok, so working off of the program you gave me befo

let's say i want to stick with the double lines. the code should first
clear the formatting, sort the data, then reapply the double lines, then use
the code you gave me before.

the part i'm stuck on is reapplying the double lines. how do i tell it to
put a double line where it is a new job? along the helper column, each time
the name changes it is a new job. i know i have to do something with this,
but i'm lost on how to apply it. thanks again for all your help.

steve

"Dave Peterson" wrote:

Double lines are just formatting, right?

First thing I would try to do is to put all my data on one row. It makes
sorting much easier.

If I couldn't do that, then I'd use the helper columns (like you did).

But then I'd clear the formatting and reapply it--just add that code to your
sort macro.

I don't like putting extra blank rows in my data.

===
One more option to make reading a little easier. Instead of using double lines,
just double the height of the first row of each group (with alignment at the
bottom). It'll give the look that the group is double spaced.

(you'll have to autofit your rows, sort, then reapply the row height doubling,
too.)

steve wrote:

going off the code you gave me.....

the grouping part worked perfect. i also have sort buttons with the code
you gave me worked into them. the issue is that the double lines do not
move. i'm working on a way that it places the double line in the rows where
the formulas change. this is because each job has the same formulas in all
its rows.

the reason this is so confusing is because the only way i can keep these
jobs together when i sort is to use helper columns. the helper columns copy
the job name into all the rows for that job, that way they stay together
during sorting.

would it be easier for the code to:

1) go through and distinguish between jobs (based on the change in the
helper columns) then add a double line to break

2) should i just use a space to break up the different jobs, and copy the
formulas into the blank row (to keep the blank row as part of the job)

"steve" wrote:

that was awesome man, thanks a lot

"Dave Peterson" wrote:

Try doing this by hand once. You'll may see that all the rows are grouped
together--since there isn't a break between each group.

But this may work for you:

Option Explicit
Sub testme01()

Dim TopCell As Range
Dim BotCell As Range
Dim FirstRow As Long
Dim LastRow As Long
Dim iRow As Long
Dim wks As Worksheet

Set wks = ActiveSheet

With wks
'clean up first.
.Cells.ClearOutline

FirstRow = 2
LastRow = .Cells.SpecialCells(xlCellTypeLastCell).Row

Set TopCell = .Cells(FirstRow, "A")
Set BotCell = TopCell

For iRow = FirstRow + 1 To LastRow
If .Cells(iRow, "A").Borders(xlEdgeBottom).LineStyle _
= xlDouble Then
Set BotCell = .Cells(iRow, "A")
.Range(TopCell.Offset(1, 0), BotCell).Rows.Group
Set TopCell = BotCell.Offset(1, 0)
Set BotCell = TopCell
End If
Next iRow

If BotCell.Row = LastRow Then
'do nothing
Else
.Range(BotCell.Offset(1, 0), .Cells(LastRow, "a")).Rows.Group
End If

End With

End Sub

steve wrote:

is there a code to go through by rows and find when a certain cell border
comes up? For example, if i have rows lumped in groups of three, and each
set of three is seperated by the double line border.

is there a way to tell it to group (Datat--Group) these three together
based on the fact that they are withing this border?

for example, (i would not know how to program this)

search row by row
when it finds the double line, start grouping.
when it finds the double line again, stop that group and start another one

thanks
steve

--

Dave Peterson


--

Dave Peterson


--

Dave Peterson


--

Dave Peterson


--

Dave Peterson


--

Dave Peterson

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
CD Programming nelson Excel Discussion (Misc queries) 0 June 4th 06 04:32 PM
Programming to VBE Ron de Bruin Excel Programming 1 September 15th 04 07:51 PM
Programming to VBE Tom Ogilvy Excel Programming 0 August 30th 04 04:15 PM
Conditional Formatting and programming??? ChrisBat Excel Programming 2 June 30th 04 01:02 AM
How to add via programming ? Milind Excel Programming 3 September 10th 03 11:57 PM


All times are GMT +1. The time now is 06:45 PM.

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

About Us

"It's about Microsoft Excel"