shazamy
01-19-2016, 03:19 AM
Hello,
ive been working on a macro to ease up thing with an excel i need to produce every couple of minutes.
a part of the code is a little buggy because it gives me error 91 marking "rngG.Select" after debug when the object the code is looking for doesnt exist:
Dim c As Range Dim rngG As Range
For Each c In Intersect(ActiveSheet.UsedRange, Columns("a"))
If c = "Artur" Then
If rngG Is Nothing Then Set rngG = c.EntireRow
Set rngG = Union(rngG, c.EntireRow)
End If
Next c
rngG.Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With
need your help with altering the code abit so if it doesnt find "Artur" then just continue
ive been working on a macro to ease up thing with an excel i need to produce every couple of minutes.
a part of the code is a little buggy because it gives me error 91 marking "rngG.Select" after debug when the object the code is looking for doesnt exist:
Dim c As Range Dim rngG As Range
For Each c In Intersect(ActiveSheet.UsedRange, Columns("a"))
If c = "Artur" Then
If rngG Is Nothing Then Set rngG = c.EntireRow
Set rngG = Union(rngG, c.EntireRow)
End If
Next c
rngG.Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With
need your help with altering the code abit so if it doesnt find "Artur" then just continue