Formatting

  • Thread starter Thread starter Maril
  • Start date Start date
M

Maril

I know this probably seems so simple, but I cannot figure
out how to do it. I've read the Help files, but if
Outlining is supposed to accomplish this, I can't figure
out how. Please help!
I need to format my spreadsheet:

A B qwer wre
A B mjh hgjk
A B iuo sdv

B C jmh dfg
B C fgjh fghjgh

So it displays in outline format like this:
A B qwer wre
mjh hgjk
iuo sdv

B C jmh dfg
fgjh fghjgh

Thanks, Maril
 
HI,

I'm not sure Outlining will do what you want.

You can try this macro. (select the A-col heading for
your data) - try on TEST data first!! It clears out
duplicates in col A and B. Nothing fancy - no true
outlining.

Sub outlineIT()
lastrow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
selectrow = ActiveCell.Row
lastA = ""
lastB = ""
For J = selectrow To lastrow
If Range("A" & J + 1).Value = lastA And _
Range("B" & J + 1).Value = lastB Then
ActiveCell.Offset(1, 0) = ""
ActiveCell.Offset(1, 1) = ""
Else
lastA = Range("A" & J + 1).Value
lastB = Range("B" & J + 1).Value
End If
ActiveCell.Offset(1, 0).Select
Next J
End Sub

jeff
 
It works!!! Maril
-----Original Message-----
HI,

I'm not sure Outlining will do what you want.

You can try this macro. (select the A-col heading for
your data) - try on TEST data first!! It clears out
duplicates in col A and B. Nothing fancy - no true
outlining.

Sub outlineIT()
lastrow = ActiveSheet.Cells(Rows.Count, "A").End (xlUp).Row
selectrow = ActiveCell.Row
lastA = ""
lastB = ""
For J = selectrow To lastrow
If Range("A" & J + 1).Value = lastA And _
Range("B" & J + 1).Value = lastB Then
ActiveCell.Offset(1, 0) = ""
ActiveCell.Offset(1, 1) = ""
Else
lastA = Range("A" & J + 1).Value
lastB = Range("B" & J + 1).Value
End If
ActiveCell.Offset(1, 0).Select
Next J
End Sub

jeff
.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top