Private Sub NewB_Click()
ActiveSheet.Unprotect
LF = Range("J1").End(xlDown).Row + 1
Cells(LF, 10) = NText.Text
Cells(LF, 11) = CText.Text
Cells(LF, 12) = RText.Text
Cells(LF, 13) = MText.Text
Cells(LF, 14) = MtText.Text
Cells(LF, 15) = PText.Text
Cells(LF, 16) = OText.Text
Cells(LF, 9).Select
結帳Text.Text = Cells(LF, 17)
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True, AllowFormattingCells:=True
NText.Text = " "
CText.Text = " "
RText.Text = " "
MText.Text = " "
MtText.Text = " "
PText.Text = " "
OText.Text = " "
End Sub
正常執行後 第二行會開始無法計算 而變#VALUE!
Q3公式是=$C$2K3+$D$2L3+$E$2M3+$F$2N3+$G$2O3+$H$2P3
你的寫法出錯是因為L3
與N3
的值不是blank
,是""
把Q3
改寫為
=SUMPRODUCT($C$2:$H$2,K3:P3)