单元格值不填充循环宏

时间:2016-06-02 13:22:06

标签: excel excel-vba vba

我正在尝试使用4个不同的标准填充日记表单。现在它遍历循环但不填充单元格值。目标是遍历4列,然后在新目标表(表单)上填充它们然后保存s截至目前我的代码是:

Dim rowCount As Integer
Dim CurOPRID As String
Dim CurName As String
Dim CurBU As String
Dim CurJournalID As String
Dim CurJournalDate As String

Dim FILE_NAME As String

Sheets("List").Select

rowCount = ActiveSheet.UsedRange.Rows.count

Set Destsh = ActiveWorkbook.Sheets("sheet")

For sourceRow = 2 To rowCount


'CurOPRID = Range("A" & CStr(sourceRow)) 'OPRID-NOT NEEDED
CurName = Range("B" & CStr(sourceRow)) 'Name
CurBU = Range("C" & CStr(sourceRow)) 'BU
CurJournalID = Range("D" & CStr(sourceRow)) 'Journal ID
CurJournalDate = Range("E" & CStr(sourceRow)) 'Journal Date


'Destsh.Range("d27") = CurOPRID
Destsh.Range("K27") = CurName
Destsh.Range("D7") = CurBU
Destsh.Range("G7") = CurJournalID
Destsh.Range("I7") = CurJournalDate


Next sourceRow

End Sub

非常简单,因为我是VBA的新手,但任何帮助都会受到赞赏!

0 个答案:

没有答案