I have coded an Excel macro that imports data from a csv file and then copies rows based on a checked value and places the parsed data into separate sheets. I am checking for 12 values and the first 9 work, but once it gets to 10, 11, and 12 the macro only copies 1 row. Is this a problem with my code or is this a limitation of excel? If it is my code, what should I adjust?
Top module:
Sub Import_Parse_Refresh()
'Import Data CSV
Call GetCSVList
'Parse Data Based on Report ID
Call Data_Parse_All
'Refresh Each Pivot Table
Call TableRefresh
'Delete Imported_Data that was created during the import
Sheets("Imported_Data").Delete
Sheets("Begin").Delete
'Save File As
Call SaveFile
End Sub
Data_Parse_All module:
Sub Data_Parse_All()
Call Data_Parse_1
Call Data_Parse_2
Call Data_Parse_3
Call Data_Parse_4
Call Data_Parse_5
Call Data_Parse_6
Call Data_Parse_7
Call Data_Parse_8
Call Data_Parse_9
Call Data_Parse_10
Call Data_Parse_11
Call Data_Parse_12
End Sub
Data_Parse_9-this code is used for all 12 Data_Parse_# modules but only 1 through 9 work correctly:
Sub Data_Parse_9()
'
Sheets("Imported_Data").Select
RowCount = Cells(Cells.Rows.Count, "I").End(xlUp).Row
For i = 1 To RowCount
Range("I" & i).Select
check_value = ActiveCell
If check_value = "9" Then
ActiveCell.EntireRow.Cut
Sheets("Report 9").Select
RowCount = Cells(Cells.Rows.Count, "A").End(xlUp).Row
Range("A" & RowCount + 1).Select
ActiveSheet.Paste
Sheets("Imported_Data").Select
End If
Next
End Sub
Data_Parse_10 -The code is the same but this is when only one row is copied
Sub Data_Parse_10()
'
' Macro1_Data Macro
'
'assuming the data is in sheet1
Sheets("Imported_Data").Select
RowCount = Cells(Cells.Rows.Count, "I").End(xlUp).Row
For i = 1 To RowCount
Range("I" & i).Select
check_value = ActiveCell
If check_value = "10" Then
ActiveCell.EntireRow.Cut
Sheets("Report 10").Select
RowCount = Cells(Cells.Rows.Count, "A").End(xlUp).Row
Range("A" & RowCount + 1).Select
ActiveSheet.Paste
Sheets("Imported_Data").Select
End If
Next
End Sub