我正在搜索人員中的一列工作簿並將其複製到rota工作簿中的下一個空行。我遇到的問題是它也複製列標題(第一行)。根據下面的代碼,關於如何排除包含列標題的第一行的任何建議?vba - 複製除列標題外的所有數據
' find the column in the people workbook
name = WorksheetFunction.Match("name", people.Sheets("Open").Rows(1), 0)
num = WorksheetFunction.Match("num", people.Sheets("Open").Rows(1), 0)
'find the next empty row
Dim lastrow As Integer
lastrow = rota.Sheets("Offer").Range("A" & Rows.Count).End(xlUp).Row + 1
' copy from the people workbook into the next free space in rota workbook
people.Sheets("Open").Columns(name).Copy Destination:=rota.Sheets("Offer").Range("A" & Rows.Count).End(xlUp).Offset(1)
people.Sheets("Open").Columns(num).Copy Destination:=rota.Sheets("Offer").Range("B" & lastrow)
林在以下點,我需要指定不第一行復制,而不是複製命名爲「民」整列猜測它...
people.Sheets("Open").Columns(num).Copy Destination:=rota.Sheets("Offer").Range("B" & lastrow)
檢查了這一點:http://superuser.com/questions/42304/select-an-entire-column-minus-header-row-in-an-excel-macro – Vityata