excel vba插入行格式 [英] excel vba insert row with formatting
问题描述
这里是插入代码:
行(B:B)插入Shift:= xlDown,CopyOrigin:= xlFormatFromLeftOrAbove
是否有可能改变它?
最好,美国
我不确定你是如何插入你的行的,但是如果你在现有行的下面插入行,默认情况下它会在上面的行上格式化,至少当你使用这种类型时的语法:
范围(B2)。EntireRow.Offset(1,0).Insert
< code
$ b在这个例子中,它将在B2下面插入一行,格式(比如B2的行被高亮显示为黄色)会变成黄色好。这可能与这种插入类型指定在哪一行插入的事实有关。
I have a macro which inserts a number of rows depending on user input in Excel 2007. Everything works but I still have a minor issue. I want to copy the complete formatting from the row above. It only works for some cells in the row.
Here is the code for insertion:
Rows("B:B").Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Is it possible to change it?
best, US
解决方案 I am not sure exactly how you are inserting your rows, but if you insert the row below an existing one, it will by default take on the formatting of the row above it, at least it does when you use this type of syntax:
Range("B2").EntireRow.Offset(1, 0).Insert
In this example, it will insert a row below B2 and the format (say, B2's row is highlighted yellow) will be yellow as well. It might have to do with the fact that this type of inserting specifies exactly under which row to insert.
这篇关于excel vba插入行格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!