ایجاد border در اکسل
Collapse
X
-
مهدي جان زحمت كشيدن و اصل كار رو انجام دادن. منم يه دستكاري كوچولو (البته با اجازه مهدي عزيز) تو فايل كردم وقتي سلول خالي باشه كادر هم جلوش نباشه. شايد كاربرد داشته باشه براتون
اين كدي كه بايد داخل sheet1 نوشته بشه
کد:Private Sub Worksheet_Change(ByVal Target As Range) If Selection.Column = 1 Then m = Target.Row Range(Cells(m, "B"), Cells(m, "f")).Select Selection.Borders(xlDiagonalDown).LineStyle = xlNone Selection.Borders(xlDiagonalUp).LineStyle = xlNone With Selection.Borders(xlEdgeLeft) .LineStyle = xlContinuous .ColorIndex = 0 .TintAndShade = 0 .Weight = xlThin End With With Selection.Borders(xlEdgeTop) .LineStyle = xlContinuous .ColorIndex = 0 .TintAndShade = 0 .Weight = xlThin End With With Selection.Borders(xlEdgeBottom) .LineStyle = xlContinuous .ColorIndex = 0 .TintAndShade = 0 .Weight = xlThin End With With Selection.Borders(xlEdgeRight) .LineStyle = xlContinuous .ColorIndex = 0 .TintAndShade = 0 .Weight = xlThin End With With Selection.Borders(xlInsideVertical) .LineStyle = xlContinuous .ColorIndex = 0 .TintAndShade = 0 .Weight = xlThin End With With Selection.Borders(xlInsideHorizontal) .LineStyle = xlContinuous .ColorIndex = 0 .TintAndShade = 0 .Weight = xlThin End With End If Range("A" & m).Select If Target.Value = "" Then Call unboarder(m) End Sub
کد:Sub unboarder(m) Range(Cells(m, "B"), Cells(m, "f")).Select Selection.Borders(xlDiagonalDown).LineStyle = xlNone Selection.Borders(xlDiagonalUp).LineStyle = xlNone Selection.Borders(xlEdgeLeft).LineStyle = xlNone Selection.Borders(xlEdgeTop).LineStyle = xlNone Selection.Borders(xlEdgeBottom).LineStyle = xlNone Selection.Borders(xlEdgeRight).LineStyle = xlNone Selection.Borders(xlInsideVertical).LineStyle = xlNone Selection.Borders(xlInsideHorizontal).LineStyle = xlNone Range("A" & m).Select End Sub
Leave a comment:
-
-
دروباره چک کن در ستون a هر مقداری بنویسی سطر جلوشو باید خط دار کنه
دوستان دیگه هم چک کننLeave a comment:
-
-
-
-
-
با سلام دوست عزیز کد زیر خدمت شما
کد:Private Sub Worksheet_Change(ByVal Target As Range) If Selection.Column = 1 Then m = Target.Row Range(Cells(m, "B"), Cells(m, "f")).Select Selection.Borders(xlDiagonalDown).LineStyle = xlNone Selection.Borders(xlDiagonalUp).LineStyle = xlNone With Selection.Borders(xlEdgeLeft) .LineStyle = xlContinuous .ColorIndex = 0 .TintAndShade = 0 .Weight = xlThin End With With Selection.Borders(xlEdgeTop) .LineStyle = xlContinuous .ColorIndex = 0 .TintAndShade = 0 .Weight = xlThin End With With Selection.Borders(xlEdgeBottom) .LineStyle = xlContinuous .ColorIndex = 0 .TintAndShade = 0 .Weight = xlThin End With With Selection.Borders(xlEdgeRight) .LineStyle = xlContinuous .ColorIndex = 0 .TintAndShade = 0 .Weight = xlThin End With With Selection.Borders(xlInsideVertical) .LineStyle = xlContinuous .ColorIndex = 0 .TintAndShade = 0 .Weight = xlThin End With With Selection.Borders(xlInsideHorizontal) .LineStyle = xlContinuous .ColorIndex = 0 .TintAndShade = 0 .Weight = xlThin End With End If End Sub
Leave a comment:
Leave a comment: