Sub fill() Dim sht1 As Worksheet Dim sht2 As Worksheet Set sht1 = Worksheets("sheet1") Set sht2 = Worksheets("sheet4") n = sht2.Range("A36500").End(xlUp).Row + 1 sht2.Cells(n, 1) = sht2.Cells(n, 1) + n - 1 sht2.Cells(n, 2) = sht1.Range("G4") sht2.Cells(n, 3) = sht1.Range("D18") sht2.Cells(n, 4) = sht1.Range("D6") sht2.Cells(n, 5) = sht1.Range("D26&D28&D30") sht2.Cells(n, 6) = sht1.Range("D88") sht2.Cells(n, 7) = sht1.Range("H281") sht2.Cells(n, 9) = sht1.Range("right(D10,8,6)") End Sub
测试时说,变量n未定义! |