Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Diagonal Border Conditional Format

I need to apply Diagonal Borders to cells B15:B25 in an X
configuration. Based off of the values in C15:C25. If C15:C25 are
Blank no borders, If they are not blank Borders...lol. I have no idea
what I am doing and any help would be greatly appreciated!!!

God Bless
Glenn

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default Diagonal Border Conditional Format

something like this may work for you, watch for line wrap

Sub Macro1()
Dim ws As Worksheet
Dim i As Long
Set ws = Worksheets("Sheet1")

For i = 15 To 25
With ws.Range("C" & i)
If .Value = "" Then
With .Offset(0, -1).Borders(xlDiagonalDown)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With .Offset(0, -1).Borders(xlDiagonalUp)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
.Offset(0, -1).Borders(xlEdgeLeft).LineStyle = xlNone
.Offset(0, -1).Borders(xlEdgeTop).LineStyle = xlNone
.Offset(0, -1).Borders(xlEdgeBottom).LineStyle = xlNone
.Offset(0, -1).Borders(xlEdgeRight).LineStyle = xlNone
Else
.Offset(0, -1).Borders(xlEdgeLeft).LineStyle = xlNone
.Offset(0, -1).Borders(xlEdgeTop).LineStyle = xlNone
.Offset(0, -1).Borders(xlEdgeBottom).LineStyle = xlNone
.Offset(0, -1).Borders(xlEdgeRight).LineStyle = xlNone
With .Offset(0, -1).Borders(xlDiagonalDown)
.LineStyle = xlNone
End With
With .Offset(0, -1).Borders(xlDiagonalUp)
.LineStyle = xlNone
End With

End If
End With
Next

End Sub


--


Gary


"QTGlennM" wrote in message
ups.com...
I need to apply Diagonal Borders to cells B15:B25 in an X
configuration. Based off of the values in C15:C25. If C15:C25 are
Blank no borders, If they are not blank Borders...lol. I have no idea
what I am doing and any help would be greatly appreciated!!!

God Bless
Glenn



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Diagonal Border Conditional Format

On May 26, 11:24 pm, "Gary Keramidas" <GKeramidasATmsn.com wrote:
something like this may work for you, watch for line wrap

Sub Macro1()
Dim ws As Worksheet
Dim i As Long
Set ws = Worksheets("Sheet1")

For i = 15 To 25
With ws.Range("C" & i)
If .Value = "" Then
With .Offset(0, -1).Borders(xlDiagonalDown)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With .Offset(0, -1).Borders(xlDiagonalUp)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
.Offset(0, -1).Borders(xlEdgeLeft).LineStyle = xlNone
.Offset(0, -1).Borders(xlEdgeTop).LineStyle = xlNone
.Offset(0, -1).Borders(xlEdgeBottom).LineStyle = xlNone
.Offset(0, -1).Borders(xlEdgeRight).LineStyle = xlNone
Else
.Offset(0, -1).Borders(xlEdgeLeft).LineStyle = xlNone
.Offset(0, -1).Borders(xlEdgeTop).LineStyle = xlNone
.Offset(0, -1).Borders(xlEdgeBottom).LineStyle = xlNone
.Offset(0, -1).Borders(xlEdgeRight).LineStyle = xlNone
With .Offset(0, -1).Borders(xlDiagonalDown)
.LineStyle = xlNone
End With
With .Offset(0, -1).Borders(xlDiagonalUp)
.LineStyle = xlNone
End With

End If
End With
Next

End Sub

--

Gary

"QTGlennM" wrote in message

ups.com...

I need to apply Diagonal Borders to cells B15:B25 in an X
configuration. Based off of the values in C15:C25. If C15:C25 are
Blank no borders, If they are not blank Borders...lol. I have no idea
what I am doing and any help would be greatly appreciated!!!


God Bless
Glenn


Worked Great is there anyway I can run it when I select the sheet?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default Diagonal Border Conditional Format

yes, in the vb editor, under microsoft excel objects, double click the correct
sheet and paste this in the sheet module. don't forget to change the sheet
references in the code. i refer to sheet1 he

Private Sub Worksheet_Activate()
Dim ws As Worksheet
Dim i As Long
Set ws = Worksheets("Sheet1")

For i = 15 To 25
With ws.Range("C" & i)
If .Value = "" Then
With .Offset(0, -1).Borders(xlDiagonalDown)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With .Offset(0, -1).Borders(xlDiagonalUp)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
.Offset(0, -1).Borders(xlEdgeLeft).LineStyle = xlNone
.Offset(0, -1).Borders(xlEdgeTop).LineStyle = xlNone
.Offset(0, -1).Borders(xlEdgeBottom).LineStyle = xlNone
.Offset(0, -1).Borders(xlEdgeRight).LineStyle = xlNone
Else
.Offset(0, -1).Borders(xlEdgeLeft).LineStyle = xlNone
.Offset(0, -1).Borders(xlEdgeTop).LineStyle = xlNone
.Offset(0, -1).Borders(xlEdgeBottom).LineStyle = xlNone
.Offset(0, -1).Borders(xlEdgeRight).LineStyle = xlNone
With .Offset(0, -1).Borders(xlDiagonalDown)
.LineStyle = xlNone
End With
With .Offset(0, -1).Borders(xlDiagonalUp)
.LineStyle = xlNone
End With

End If
End With
Next

End Sub


--


Gary


"QTGlennM" wrote in message
oups.com...
On May 26, 11:24 pm, "Gary Keramidas" <GKeramidasATmsn.com wrote:
something like this may work for you, watch for line wrap

Sub Macro1()
Dim ws As Worksheet
Dim i As Long
Set ws = Worksheets("Sheet1")

For i = 15 To 25
With ws.Range("C" & i)
If .Value = "" Then
With .Offset(0, -1).Borders(xlDiagonalDown)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With .Offset(0, -1).Borders(xlDiagonalUp)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
.Offset(0, -1).Borders(xlEdgeLeft).LineStyle = xlNone
.Offset(0, -1).Borders(xlEdgeTop).LineStyle = xlNone
.Offset(0, -1).Borders(xlEdgeBottom).LineStyle =
xlNone
.Offset(0, -1).Borders(xlEdgeRight).LineStyle =
xlNone
Else
.Offset(0, -1).Borders(xlEdgeLeft).LineStyle = xlNone
.Offset(0, -1).Borders(xlEdgeTop).LineStyle = xlNone
.Offset(0, -1).Borders(xlEdgeBottom).LineStyle =
xlNone
.Offset(0, -1).Borders(xlEdgeRight).LineStyle =
xlNone
With .Offset(0, -1).Borders(xlDiagonalDown)
.LineStyle = xlNone
End With
With .Offset(0, -1).Borders(xlDiagonalUp)
.LineStyle = xlNone
End With

End If
End With
Next

End Sub

--

Gary

"QTGlennM" wrote in message

ups.com...

I need to apply Diagonal Borders to cells B15:B25 in an X
configuration. Based off of the values in C15:C25. If C15:C25 are
Blank no borders, If they are not blank Borders...lol. I have no idea
what I am doing and any help would be greatly appreciated!!!


God Bless
Glenn


Worked Great is there anyway I can run it when I select the sheet?



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
Can two formats be applied to a cell with a diagonal border Deb-Ellen Excel Discussion (Misc queries) 1 May 7th 08 10:28 AM
conditional format overriding border Teresa Excel Discussion (Misc queries) 0 April 30th 08 05:08 PM
different colour each side of diagonal border frisby Excel Discussion (Misc queries) 2 June 19th 06 03:55 PM
Conditional Format - Outline Border Drahos Excel Worksheet Functions 2 February 1st 06 09:42 AM
Two Different Diagonal Border Colors in the Same Cell James Cox[_2_] Excel Programming 0 November 1st 04 10:04 PM


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