PC Review


Reply
Thread Tools Rate Thread

Diagonal Border Conditional Format

 
 
QTGlennM
Guest
Posts: n/a
 
      27th May 2007
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

 
Reply With Quote
 
 
 
 
Gary Keramidas
Guest
Posts: n/a
 
      27th May 2007
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>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
>



 
Reply With Quote
 
QTGlennM
Guest
Posts: n/a
 
      27th May 2007
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" <glenn.m.dav...@gmail.com> wrote in message
>
> news:(E-Mail Removed)...
>
> >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 With Quote
 
Gary Keramidas
Guest
Posts: n/a
 
      27th May 2007
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 here:

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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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" <glenn.m.dav...@gmail.com> wrote in message
>>
>> news:(E-Mail Removed)...
>>
>> >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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
conditional format overriding border Teresa Microsoft Excel Misc 2 30th Apr 2008 05:31 PM
Conditional format -- other fields including border =?Utf-8?B?RXJpY19H?= Microsoft Access Reports 4 3rd Aug 2007 11:59 PM
Conditional Format - Outline Border Sam via OfficeKB.com Microsoft Excel Worksheet Functions 12 1st May 2007 03:04 AM
Conditional Format - Outline Border =?Utf-8?B?RHJhaG9z?= Microsoft Excel Worksheet Functions 2 1st Feb 2006 09:42 AM
Border goes Solid on Conditional Format John Geddes Microsoft Access Form Coding 0 29th Mar 2005 04:03 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:26 AM.