运行时错误1004 方法range作用于对象worksheet时失败 5
PrivateSub合并(ByVal区域AsRange)With区域.Merge.HorizontalAlignment=xlCenter.VerticalAlignme...
Private Sub 合并(ByVal 区域 As Range)
With 区域
.Merge
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
End With
End Sub
Private Sub 填充边框(ByVal 区域 As Range)
With 区域
.Borders.LineStyle = xlContinuous
.Borders.Weight = xlThin
.Borders(xlEdgeBottom).Weight = xlMedium
.Borders(xlEdgeLeft).Weight = xlMedium
.Borders(xlEdgeRight).Weight = xlMedium
.Borders(xlEdgeTop).Weight = xlMedium
End With
End Sub
Public Sub 表格整理()
Application.DisplayAlerts = False
Dim MR As Long, R As Long, FR As Long, RV As String
MR = Sheet1.UsedRange.Rows.Count
For R = 1 To MR + 1
If RV = "" Then RV = Sheet1.Cells(R, 1): FR = R
If Sheet1.Cells(R, 1) <> RV Then
Call 合并(Sheet1.Range(Cells(FR, 1), Cells(R - 1, 1)))
Call 填充边框(Sheet1.Range(Cells(FR, 1), Cells(R - 1, 11)))
FR = R
RV = SH.Cells(R, 1)
End If
Next R
Application.DisplayAlerts = True
End Sub
Call 合并(Sheet1.Range(Cells(FR, 1), Cells(R - 1, 1)))
系统显示这句标黄了,请问如何修改 展开
With 区域
.Merge
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
End With
End Sub
Private Sub 填充边框(ByVal 区域 As Range)
With 区域
.Borders.LineStyle = xlContinuous
.Borders.Weight = xlThin
.Borders(xlEdgeBottom).Weight = xlMedium
.Borders(xlEdgeLeft).Weight = xlMedium
.Borders(xlEdgeRight).Weight = xlMedium
.Borders(xlEdgeTop).Weight = xlMedium
End With
End Sub
Public Sub 表格整理()
Application.DisplayAlerts = False
Dim MR As Long, R As Long, FR As Long, RV As String
MR = Sheet1.UsedRange.Rows.Count
For R = 1 To MR + 1
If RV = "" Then RV = Sheet1.Cells(R, 1): FR = R
If Sheet1.Cells(R, 1) <> RV Then
Call 合并(Sheet1.Range(Cells(FR, 1), Cells(R - 1, 1)))
Call 填充边框(Sheet1.Range(Cells(FR, 1), Cells(R - 1, 11)))
FR = R
RV = SH.Cells(R, 1)
End If
Next R
Application.DisplayAlerts = True
End Sub
Call 合并(Sheet1.Range(Cells(FR, 1), Cells(R - 1, 1)))
系统显示这句标黄了,请问如何修改 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询