Sub test()Dim i, m, nApplication.ScreenUpdating = FalseFor i = 3 To 33 m = Sheets(i).Range("AS65536").End(xlUp).Row If m > 5 Then For x = 6 To m If Sheets(i).Range("AS" & x) <> "" Then n = Sheets(2).Range("AS65536").End(xlUp).Row + 1 arr = Sheets(i).Range("AD" & x).Resize(1, 40) Sheets(2).Range("AD" & n).Resize(1, 40) = arr End If Next End IfNextApplication.ScreenUpdating = TrueEnd Sub
用VBA做了一個
Sub test()Dim i, m, nApplication.ScreenUpdating = FalseFor i = 3 To 33 m = Sheets(i).Range("AS65536").End(xlUp).Row If m > 5 Then For x = 6 To m If Sheets(i).Range("AS" & x) <> "" Then n = Sheets(2).Range("AS65536").End(xlUp).Row + 1 arr = Sheets(i).Range("AD" & x).Resize(1, 40) Sheets(2).Range("AD" & n).Resize(1, 40) = arr End If Next End IfNextApplication.ScreenUpdating = TrueEnd Sub
實際效果看附件吧