当用户在单元格D7中输入数字N时,我试图生成N个行。这些行需要设置边框格式。 x1薄
每更改N个数字,行数也必须更改
任何人都可以帮忙吗?
答案 0 :(得分:0)
将其放置在您要在其上运行的图纸对象后面
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim NoRows As Long
If Not Intersect(Target, Me.Range("D7")) Is Nothing Then
With Me
NoRows = .Range("D7").Value2
' Update with your reference to where the first row you want to change is
With .Range("A1").Resize(NoRows)
With .Borders
.Weight = xlThin
.LineStyle = xlContinuous
End With
End With
End With
End If
End Sub