一、請問怎麼簡化
二、為何都只有錄入Cells(51, n)?
Y = Sheets("成交客戶").Range("b65536").End(xlUp).Row
With Sheets("成交客戶")
.Range("a" & Y + 1) = Sheets("日報表輸入").Range("e2").Value '日期
For n = 3 To 7
.Cells(Y + 1, n - 1) = Sheets("日報表輸入").Cells(41, n).Value
If Sheets("日報表輸入").Cells(42, n).Value <> "" Then
.Cells(Y + 1, n - 1) = Sheets("日報表輸入").Cells(42, n).Value
End If
If Sheets("日報表輸入").Cells(43, n).Value <> "" Then
.Cells(Y + 1, n - 1) = Sheets("日報表輸入").Cells(43, n).Value
End If
Next n
If Sheets("日報表輸入").Cells(44, n).Value <> "" Then
.Cells(Y + 1, n - 1) = Sheets("日報表輸入").Cells(44, n).Value
End If
If Sheets("日報表輸入").Cells(45, n).Value <> "" Then
.Cells(Y + 1, n - 1) = Sheets("日報表輸入").Cells(45, n).Value
End If
If Sheets("日報表輸入").Cells(46, n).Value <> "" Then
.Cells(Y + 1, n - 1) = Sheets("日報表輸入").Cells(46, n).Value
End If
Next n
If Sheets("日報表輸入").Cells(47, n).Value <> "" Then
.Cells(Y + 1, n - 1) = Sheets("日報表輸入").Cells(47, n).Value
End If
If Sheets("日報表輸入").Cells(48, n).Value <> "" Then
.Cells(Y + 1, n - 1) = Sheets("日報表輸入").Cells(48, n).Value
End If
If Sheets("日報表輸入").Cells(49, n).Value <> "" Then
.Cells(Y + 1, n - 1) = Sheets("日報表輸入").Cells(49, n).Value
End If
Next n
If Sheets("日報表輸入").Cells(50, n).Value <> "" Then
.Cells(Y + 1, n - 1) = Sheets("日報表輸入").Cells(50, n).Value
End If
If Sheets("日報表輸入").Cells(51, n).Value <> "" Then
.Cells(Y + 1, n - 1) = Sheets("日報表輸入").Cells(51, n).Value
End If
Next n作者: GBKEE 時間: 2010-8-12 10:19
回復 1#olisun
Y = Sheets("成交客戶").Range("b65536").End(xlUp).Row
With Sheets("成交客戶")
.Range("a" Y + 1) = Sheets("日報表輸入").Range("e2").Value '日期 語法錯誤
.Range("a" &Y + 1) = Sheets("日報表輸入").Range("e2").Value '日期 正確