Borders in Columns

  • Thread starter Thread starter Juan
  • Start date Start date
J

Juan

Hello,
I want to format my columns wth borders, but if I select
example Columns("A:G").Select
It will put borders all the way down. I want to put
borders just to the last row of data. So when user wants
to print report it doesn't show Borders all the way down.

Please advise any info. would appreciate it.

Thanks,

Juan
 
So use Conditional Formatting. Assuming one of those columns will always have
data in it if any exists for that row, then just tie a CF formula to it, eg:-

Select A:G do Format / Cond Formatting - Formula Is =$A1<>"" then hit the
format button and chosee left and right borders. Any time there is data in a
row in Col A, you will have borders from A:G
 
iLastRow = Cells(Rows.Count,"A").End(xlUp)
Range("A" & iLastRow & ":G" & iLastRow).Select

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Hello Bob,
not working. is there more to the code? Also Ken, When I
do your way it deletes my other Conditional formatting. I
have a formalu that looks for the word Total and formats
that row. I'll continue playing with it, but would like
any suggestions.

Thanks both of you.

Juan
 
Hi Juan,

I have just tested it again, and I put three values in A1, A2, A3 and ran
the code. Selected A4:G4 fine.

What happens with you?

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Hello Bob,
I get error Method Range of object_Global failed. This is
portion of my macro:
Columns("D:J").Select
With Selection
.HorizontalAlignment = xlCenter
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = False
End With
iLastRow = Cells(Rows.Count, "A").End(xlUp)
Range("A" & iLastRow & ":G" & iLastRow).Select

End Sub
Please advise.
thanks,
juan
 
Juan,

This is what I meant

iLastRow = Cells(Rows.Count, "D").End(xlUp)
Range("D" & iLastRow & ":J" & iLastRow).Select
With Selection
.HorizontalAlignment = xlCenter
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = False
End With

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 

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