Excel VBA Format a Range Borders to Crossed diagonal lines
Solved/Closed
mathewmunna
Posts
22
Registration date
Tuesday 18 November 2014
Status
Member
Last seen
21 May 2015
-
13 May 2015 à 08:12
MaxStart Posts 338 Registration date Tuesday 3 March 2015 Status Contributor Last seen 3 July 2015 - 17 May 2015 à 10:35
MaxStart Posts 338 Registration date Tuesday 3 March 2015 Status Contributor Last seen 3 July 2015 - 17 May 2015 à 10:35
Related:
- Diagonal line in excel cell
- Excel cross out cell diagonal - Best answers
- How to write in diagonal line in excel - Best answers
- Excel mod apk for pc - Download - Spreadsheets
- Arrow keys not working in excel - Guide
- Excel multiple lines in one cell - Guide
- Vat calculation excel - Guide
- Number to words in excel - Guide
3 responses
MaxStart
Posts
338
Registration date
Tuesday 3 March 2015
Status
Contributor
Last seen
3 July 2015
69
15 May 2015 à 13:56
15 May 2015 à 13:56
With Selection.Borders(xlDiagonalDown)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.Weight = xlMedium
End With
With Selection.Borders(xlDiagonalUp)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.Weight = xlMedium
End With
Je ne parle pas français, mais je l'aime.
je ne pas change.
MaxStart
Posts
338
Registration date
Tuesday 3 March 2015
Status
Contributor
Last seen
3 July 2015
69
17 May 2015 à 10:35
17 May 2015 à 10:35
This will work on range A1-C10

Je ne parle pas français, mais je l'aime.
je ne pas change.
Sub Max()
Dim I As Integer, j As Integer
i = 1
j = 1
Do Until I = 11
For j = 1 To 3
If Cells(i, j).Value = "c" Then
Cells(i, j).Select
With Selection.Borders(xlDiagonalDown)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.Weight = xlMedium
End With
With Selection.Borders(xlDiagonalUp)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.Weight = xlMedium
End With
End If
Next j
i = I + 1
Loop
End Sub

Je ne parle pas français, mais je l'aime.
je ne pas change.
mathewmunna
Posts
22
Registration date
Tuesday 18 November 2014
Status
Member
Last seen
21 May 2015
17 May 2015 à 06:36
17 May 2015 à 06:36
I have another code but something is wrong in this code too
Private Sub format()
Dim R As Range, C As Range
Set R = Range("B5:G20")
Application.ScreenUpdating = False
For Each C In R
If Len(C.Text) = C Then
With Selection.Borders(xlDiagonalDown)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.Weight = xlMedium
End With
With Selection.Borders(xlDiagonalUp)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.Weight = xlMedium
End With
Else
End If
Next C
Application.ScreenUpdating = True
End Sub
Private Sub format()
Dim R As Range, C As Range
Set R = Range("B5:G20")
Application.ScreenUpdating = False
For Each C In R
If Len(C.Text) = C Then
With Selection.Borders(xlDiagonalDown)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.Weight = xlMedium
End With
With Selection.Borders(xlDiagonalUp)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.Weight = xlMedium
End With
Else
End If
Next C
Application.ScreenUpdating = True
End Sub

17 May 2015 à 06:09
i am very new to vba tried with bellow one but got some errors.. kindly help me to fix this issue..
Sub Xmark()
For Each cell In Range("A10:G26")
If Sheets("Sheet1").Range("C") Then
With Selection.Borders(xlDiagonalDown)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.Weight = xlMedium
End With
With Selection.Borders(xlDiagonalUp)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.Weight = xlMedium
End With
End Sub