根据选择 - 合并的单元格参考其他单元格
我在工作表中参考其他单元格时有问题。我有一个VBA,可以用枢轴表创建桌子,并将它们保存在不同的床单上。表的示例:
任何名称的行数都可以更改,因此总排位置也可以更改。我需要大胆整个小计和总行 (在这种情况下,它将是b9:g9,b12:g12,b14:g14,a15:g15)所以我尝试了一下:
If Right(cell.Value, 5) Like "Total" Then
With cell
.HorizontalAlignment = xlLeft
.Font.Bold = True
End With
End If
Next cell
自然而然地向其中包含“总体”文本的一个单元格。问题是在我想粗体的行中引用其他单元格 - 合并后的单元格在搞砸了。当我尝试此操作时:
cell.EntireRow.Font.Bold = True
整个项目都大胆(A5:G14)。我还尝试了偏移函数,但是偏移量(0,1)将我发送到Cell C5。
您是否知道如何使整个总和小行大胆?
谢谢, B
I have a problem with referencing to other cells in my sheet. I have a VBA that creates tables out of a pivot table and saves them on different sheets. Example of the table:
The number of rows for any name can change, the total row position can therefore change too. I needed to bold the whole subtotal and total rows
(in this case it would be B9:G9, B12:G12, B14:G14, A15:G15) so I tried this:
If Right(cell.Value, 5) Like "Total" Then
With cell
.HorizontalAlignment = xlLeft
.Font.Bold = True
End With
End If
Next cell
which naturally only bolded the one cell which has the 'Total' text in it. The problem is referencing to the other cells in the rows I want to bold - the merged cells are messing that up. When I tried this:
cell.EntireRow.Font.Bold = True
the whole Project got bold (A5:G14). I also tried the offset function, but offset(0,1) sent me to cell C5.
Do you please have any idea how to make the whole total and subtotal rows bold?
Thanks,
B.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以做这样的事情:
You could do something like this: