Borders

  • Thread starter Thread starter Khalil Handal
  • Start date Start date
K

Khalil Handal

Hello to all,
I have a range of cells C34:N35
I need VBA code in order to have borders for this range or clearing the
borders depending on the checkbox if it is cliked or not.
ie. The code will be part of CheckBox2 button with condition to show the
border or hide them.The sheet is protected.
 
Hi,

Record the code to turn on and off the borders and put it inside the
Checkbox_Click procedure.
 
NOT homework!
I was able to show / hide the numbers inside the range according to the
check box by changing the color to white and then black again. It didn't
look nice to have borders for empty cells! so the idea came to not see the
borders.
I recorded the macro and it has (i think) seven line which looks too long.

Thanks to both of you.
 
You can adapt this to make the borders

Sub bordersaround()
Worksheets("Sheet1").Range("A1:D4").BorderAround _
ColorIndex:=3, Weight:=xlThick
'Selection.bordersaround
End Sub

or this to erase them

Sub noborders()
Worksheets("Sheet1").Range("A1:D4") _
.Borders.LineStyle = xlNone
End Sub
 
Thanks!
I was always interestred in spliting the line in VB code which is seen as _
..
What key combination does this?????
 
That is the underscore character. SHIFT + - (hyphen)

Make sure you have a <space> between last character and the underscore _


Gord Dibben MS Excel MVP
 
Thanks

Gord Dibben said:
That is the underscore character. SHIFT + - (hyphen)

Make sure you have a <space> between last character and the underscore _


Gord Dibben MS Excel MVP
 
Back
Top