2014-02-19 50 views
1

小計兩列,然後使用查找替換列Z也替換列Q中的公式。 如何將其限制爲僅列Z?我試着使用選擇可見單元格,但它仍然改變柱Q.選定的列Z:Z替換公式,但也替換列Q中的公式:Q爲什麼?

Selection.Subtotal GroupBy:=11, Function:=xlSum, TotalList:=Array(17, 26) _ 
    , Replace:=True, PageBreaks:=False, SummaryBelowData:=True 
Columns("Z:Z").Select 
Selection.SpecialCells(xlCellTypeVisible).Select 
Cells.Replace What:="SUBTOTAL(9", Replacement:="SUBTOTAL(1", LookAt:= _ 
    xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _ 
    ReplaceFormat:=False 
Range("A1").Select 
+0

我的猜測是Q引用了你正在改變的值。 –

回答

1

Cells.Replace是指所有細胞的活動工作表。使用Columns("Z").Replace