运行时错误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)))
系统显示这句标黄了,请问如何修改
展开
 我来答
2的128次方
推荐于2017-11-26 · TA获得超过277个赞
知道小有建树答主
回答量:761
采纳率:68%
帮助的人:171万
展开全部
应该是你的cells没有表名引用的sheet是哪个,默认是激活的这个sheet,你写完整看看:Call 合并(Sheet1.Range(sheet1.Cells(FR, 1), sheet1.Cells(R - 1, 1)))
本回答被网友采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式