Copy header row only once in VBA macro
I have multiple workbooks that I'm copying data from and merging into a new workbook. I only want to pull in the heading row (which happens to be row 3, columns A:H) once from the first workbook since the headings are all the same, and then only copy rows 4 to the lastrow from subsequent files.
I am not a programmer, but have everything working except ignoring the heading row in subsequent files when setting the copy range. I think I need to add an "if/then" statement somewhere in here, but I'm not sure. Any help any of you VBA gurus can provide would be greatly appreciated!!!
Below is the part of the code where I believe I need to make an adjustment.
LastRow = WorkBk.Worksheets(1).Cells(Rows.Count, "A").End(xlUp).Row
Set SourceRange = WorkBk.Worksheets(1).Range("A3:H" & LastRow)
Set DestRange = SummarySheet.Range("B" & NRow)
Set DestRange = DestRange.Resize(SourceRange.Rows.Count, _
SourceRange.Columns.Count)
DestRange.Value = SourceRange.Value
NRow = NRow + DestRange.Rows.Count
Thanks!
Julie
|