I need a macro on worksheet change event to apply cell borders automatically based on cell value
Like if I type any value in cell then apply border automatically
Need a macro on worksheet change event
-
PrasadK -
September 23, 2021 at 4:40 PM -
Thread is marked as Resolved.
-
-
-
Copy this macro in the sheets vbe module and give it a try:
Code
Display MoreOption Explicit Private Sub Worksheet_Change(ByVal Target As Range) Dim borderArray, Edge If Target.Cells.Count > 1 Then Exit Sub If Target.Value <> "" Then borderArray = Array(xlEdgeLeft, xlEdgeTop, xlEdgeBottom, xlEdgeRight) For Edge = 0 To 3 With Target.Borders(borderArray(Edge)) .LineStyle = xlContinuous .Weight = xlThin End With Next Edge End If End Sub
-
Thank you so much rollis13
-
Glad having been of some help.
Participate now!
Don’t have an account yet? Register yourself now and be a part of our community!