代码在正常运行时不会执行任何操作,但在调试模式下会逐步执行

时间:2019-08-07 17:00:26

标签: excel vba

我只想更改合并单元格的大小和字体,我尝试将其视为范围和合并组的第一个单元格。当我运行代码时,它不会更改字体类型或大小,也不会更改为粗体。它将更改对齐方式和换行,但不会更改字体。

'treating it as range

 With Sheets("5x5").Range(Cells(filaeti + 2, columnaeti).Address, Cells(filaeti + 7, columnaeti + 4).Address)
    .WrapText = True
    .ShrinkToFit = False
    .HorizontalAlignment = xlLeft
    .VerticalAlignment = xlCenter
    .Font.FontStyle = "Arial Narrow"
    .Font.Bold = True
End With


*******

'treating it as the first cell of the merged group
 With Sheets("5x5").Cells(filaeti + 2, columnaeti)
    .WrapText = True
    .ShrinkToFit = False
    .HorizontalAlignment = xlLeft
    .VerticalAlignment = xlCenter
    .Font.FontStyle = "Arial Narrow"
    .Font.Bold = True
End With

0 个答案:

没有答案