Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 99
Default Borders around cells with data in them

I would like a macro to automatically put a border around any cells in
a sheet that has data in it (numbers or text)

and cells with no data have no borders.

thanks

Johnnboy
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default Borders around cells with data in them

Johnnyboy5 submitted this idea :
I would like a macro to automatically put a border around any cells in
a sheet that has data in it (numbers or text)

and cells with no data have no borders.

thanks

Johnnboy


This is something I would normally use ConditionalFormatting for
because a macro would have to be fired by a sheet event, which could
seriously hurt performance if there's a lot of data. Excel, however,
can handle this much better (and more efficiently) without penalty.

To do this using CF...
1. Click the intersecting header of row/column headers at the top left
corner of the sheet you want borders placed.

2. Choose Conditional Formatting... from the Format menu.

3. Select 'Formula' from the dropdown.

4. Enter: =A1<"" in the criteria box.

5. click the Format button and configure your border properties.

6. click OK twice.

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 99
Default Borders around cells with data in them

On Jan 22, 1:40*pm, GS wrote:
Johnnyboy5 submitted this idea :

I would like a macro to automatically put a border around any cells in
a sheet that has data in it (numbers or text)


and cells with no data have no borders.


thanks


Johnnboy


This is something I would normally use ConditionalFormatting for
because a macro would have to be fired by a sheet event, which could
seriously hurt performance if there's a lot of data. Excel, however,
can handle this much better (and more efficiently) without penalty.

To do this using CF...
1. *Click the intersecting header of row/column headers at the top left
corner of the sheet you want borders placed.

2. *Choose Conditional Formatting... from the Format menu.

3. *Select 'Formula' from the dropdown.

4. *Enter: *=A1<"" *in the criteria box.

5. *click the Format button and configure your border properties.

6. *click OK twice.

--
Garry

Free usenet access athttp://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc


Thanks - that's an awsume solution.

job done.

5 star answer
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 168
Default Borders around cells with data in them

Sub BorderRange()
With ActiveSheet
la = .Cells.Find("*", Cells(Rows.Count, Columns.Count) _
, , , xlByRows, xlPrevious).Address
..Range("a1:" & la).Borders.LineStyle = xlContinuous
End With
End Sub

On Jan 22, 7:25*am, Johnnyboy5 wrote:
I would like a macro to automatically put a border around any cells in
a sheet that has data in it (numbers or text)

and cells with no data have no borders.

thanks

Johnnboy


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 99
Default Borders around cells with data in them

On Jan 22, 3:13*pm, Don Guillett Excel MVP
wrote:
Sub BorderRange()
With ActiveSheet
la = .Cells.Find("*", Cells(Rows.Count, Columns.Count) _
, , , xlByRows, xlPrevious).Address
.Range("a1:" & la).Borders.LineStyle = xlContinuous
End With
End Sub

On Jan 22, 7:25*am, Johnnyboy5 wrote:

I would like a macro to automatically put a border around any cells in
a sheet that has data in it (numbers or text)


and cells with no data have no borders.


thanks


Johnnboy


Thanks Don for your reply -


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default Borders around cells with data in them

Johnnyboy5 brought next idea :
Thanks - that's an awsume solution.

job done.

5 star answer


You're very welcome!
Thanks for the feedback, ..always appreciated!

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc


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
Format cells with borders Jim Excel Discussion (Misc queries) 3 June 10th 07 02:24 AM
Add borders to certain cells using VBA Drew[_3_] Excel Programming 4 August 28th 06 08:27 PM
Borders around cells... syuhas[_2_] Excel Programming 1 February 28th 06 05:16 PM
Borders around cells Michelle Excel Programming 1 June 30th 04 06:33 PM
HELP! Merge cells and borders.... Maly Excel Programming 2 July 30th 03 02:38 AM


All times are GMT +1. The time now is 12:24 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"