Hello.
I am trying to reorganise some data. I have a list of numbers in column A. I want my code to look in column A for all the rows with "350" and copy and paste those rows to U4. I want it to do this for all the different numbers. There is over 100 of them.
This is what i have so far but it just takes so long. If there is a more efficient way of doing this i would appreciate the help. Thank you.
' Find the last row of data
FinalRow = Cells(Rows.Count, 1).End(xlUp).Row
' Loop through each row
For x = 4 To FinalRow
DoEvents
' Decide if to copy based on column A
ThisValue = Cells(x, 1).Value
If ThisValue = "350" Then
Cells(x, 1).Resize(1, 17).Copy
nextRow = Cells(Rows.Count, "U").End(xlUp).Row + 2
Cells(nextRow, "U").Select
ActiveSheet.Paste
DoEvents
ElseIf ThisValue = "400" Then
Cells(x, 1).Resize(1, 17).Copy
nextRow = Cells(Rows.Count, "BA").End(xlUp).Row + 2
Cells(nextRow, "BA").Select
ActiveSheet.Paste
ElseIf ThisValue = ("13717") Then
Cells(x, 1).Resize(1, 17).Copy
nextRow = Cells(Rows.Count, "CG").End(xlUp).Row + 2
Cells(nextRow, "CG").Select
ActiveSheet.Paste
ElseIf ThisValue = ("16730") Then
Cells(x, 1).Resize(1, 17).Copy
nextRow = Cells(Rows.Count, "DM").End(xlUp).Row + 2
Cells(nextRow, "DM").Select
ActiveSheet.Paste
ElseIf ThisValue = ("35723") Then
Cells(x, 1).Resize(1, 17).Copy
nextRow = Cells(Rows.Count, "ES").End(xlUp).Row + 2
Cells(nextRow, "ES").Select
ActiveSheet.Paste
ElseIf ThisValue = ("54885") Then
Cells(x, 1).Resize(1, 17).Copy
nextRow = Cells(Rows.Count, "FY").End(xlUp).Row + 2
Cells(nextRow, "FY").Select
ActiveSheet.Paste
ElseIf ThisValue = ("55677") Then
Cells(x, 1).Resize(1, 17).Copy
nextRow = Cells(Rows.Count, "HE").End(xlUp).Row + 2
Cells(nextRow, "HE").Select
ActiveSheet.Paste
Etc, Etc for over 100 different numbers
I am trying to reorganise some data. I have a list of numbers in column A. I want my code to look in column A for all the rows with "350" and copy and paste those rows to U4. I want it to do this for all the different numbers. There is over 100 of them.
This is what i have so far but it just takes so long. If there is a more efficient way of doing this i would appreciate the help. Thank you.
' Find the last row of data
FinalRow = Cells(Rows.Count, 1).End(xlUp).Row
' Loop through each row
For x = 4 To FinalRow
DoEvents
' Decide if to copy based on column A
ThisValue = Cells(x, 1).Value
If ThisValue = "350" Then
Cells(x, 1).Resize(1, 17).Copy
nextRow = Cells(Rows.Count, "U").End(xlUp).Row + 2
Cells(nextRow, "U").Select
ActiveSheet.Paste
DoEvents
ElseIf ThisValue = "400" Then
Cells(x, 1).Resize(1, 17).Copy
nextRow = Cells(Rows.Count, "BA").End(xlUp).Row + 2
Cells(nextRow, "BA").Select
ActiveSheet.Paste
ElseIf ThisValue = ("13717") Then
Cells(x, 1).Resize(1, 17).Copy
nextRow = Cells(Rows.Count, "CG").End(xlUp).Row + 2
Cells(nextRow, "CG").Select
ActiveSheet.Paste
ElseIf ThisValue = ("16730") Then
Cells(x, 1).Resize(1, 17).Copy
nextRow = Cells(Rows.Count, "DM").End(xlUp).Row + 2
Cells(nextRow, "DM").Select
ActiveSheet.Paste
ElseIf ThisValue = ("35723") Then
Cells(x, 1).Resize(1, 17).Copy
nextRow = Cells(Rows.Count, "ES").End(xlUp).Row + 2
Cells(nextRow, "ES").Select
ActiveSheet.Paste
ElseIf ThisValue = ("54885") Then
Cells(x, 1).Resize(1, 17).Copy
nextRow = Cells(Rows.Count, "FY").End(xlUp).Row + 2
Cells(nextRow, "FY").Select
ActiveSheet.Paste
ElseIf ThisValue = ("55677") Then
Cells(x, 1).Resize(1, 17).Copy
nextRow = Cells(Rows.Count, "HE").End(xlUp).Row + 2
Cells(nextRow, "HE").Select
ActiveSheet.Paste
Etc, Etc for over 100 different numbers