Macro to change border style
Macro to change border style
Macro to change border style
Macro to change border style
Macro to change border style
Macro to change border style Macro to change border style Macro to change border style Macro to change border style Macro to change border style Macro to change border style Macro to change border style Macro to change border style
Macro to change border style Macro to change border style
Macro to change border style
Go Back  Xtreme Visual Basic Talk > > > > Macro to change border style


Reply
 
Thread Tools Display Modes
  #1  
Old 08-27-2017, 01:00 PM
mogilshik's Avatar
mogilshik mogilshik is offline
Junior Contributor
 
Join Date: Aug 2003
Location: Saint-Petersburg
Posts: 366
Default Macro to change border style


Hello!
Need your help friends!
I wonder if you can help me create macro which will automatically change the colour (to white) and the width (to minimum) of all of the cell borders which have the content on a worksheet?
I found this example but it has to be shown all cells with formatting:
https://stackoverflow.com/questions/...ell-in-a-range
Thank you!
Dave
__________________
Look past them as though there's something there which is distracting you. When they turn around to see what it is, hit them on the head with an esky lid. Pretend it fell from a tree, even if there are no trees around
"...21 Fun Things To Do Or Say When Your Being Yelled At.."
Reply With Quote
  #2  
Old 08-27-2017, 08:11 PM
Kluz's Avatar
KluzMacro to change border style Kluz is offline
Sapience.Aquire

Super Moderator
* Expert *
 
Join Date: Oct 2003
Location: Lake Bluff, Ill., U.S.
Posts: 3,445
Default

If you look into the SpecialCells object an also at xlCellType you should be able to define the cells that have content. Record the macro for formatting and extract the relevant line(s) of code for the formatting.
__________________
No the other right mouse click
Reply With Quote
  #3  
Old 08-30-2017, 09:01 AM
Daigon Ali Daigon Ali is offline
Regular
 
Join Date: Aug 2014
Location: London
Posts: 59
Default

I guess it depends on what you mean by content. If you want to include both cells which contain hard data and those which contain formulas, then I've found using the Union method to be most effective.

For example, this changes the border to thin, white for all cells containing hard values or formulas.

Code:
Sub test()
Dim rng As Range
Set rng = ActiveSheet.Cells
With Union(rng.SpecialCells(xlCellTypeConstants), rng.SpecialCells(xlCellTypeFormulas)).Borders
    .LineStyle = xlContinuous
    .Color = vbWhite
    .Weight = xlThin
End With
End Sub
Reply With Quote
Reply

Tags
change, content, found, macro, worksheet, style, border


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Macro to change border style
Macro to change border style
Macro to change border style Macro to change border style
Macro to change border style
Macro to change border style
Macro to change border style Macro to change border style Macro to change border style Macro to change border style Macro to change border style Macro to change border style Macro to change border style
Macro to change border style
Macro to change border style
 
Macro to change border style
Macro to change border style
 
-->