I import a csv file into Excel. I use the file to create a dashboard for executive management. We recently picked up a customer that ships in metric weights as opposed to pounds. For this customer, I need to change the weight field in the Excel spreadsheet to pounds. I wrote a macro that runs after the import is done. The macro looks like this:
For i to LR
If Customer# = MB then
Weight=Weight*2.2045
Else
Next
End if
The variable i is the row number initialized to row 2
The variable LR is the last row which I calculate prior to starting the for loop
The weight is actual shown as cells(5,i).value and customer# is configured the same way.
The problem is that there are 25000 records in the spreadsheet and it is taking over 10 minutes to sort through them all.
Due to a constraint in an archaic ERP system, there is no way to convert the information prior to import. The system does not use any qualifiers for weight, it is simply a number(yes I know that it is stupid, but I have to deal with it for about 6 more months and then it is gone).
I need this conversion for a pivot table, summary spreadsheet and graphs.
For i to LR
If Customer# = MB then
Weight=Weight*2.2045
Else
Next
End if
The variable i is the row number initialized to row 2
The variable LR is the last row which I calculate prior to starting the for loop
The weight is actual shown as cells(5,i).value and customer# is configured the same way.
The problem is that there are 25000 records in the spreadsheet and it is taking over 10 minutes to sort through them all.
Due to a constraint in an archaic ERP system, there is no way to convert the information prior to import. The system does not use any qualifiers for weight, it is simply a number(yes I know that it is stupid, but I have to deal with it for about 6 more months and then it is gone).
I need this conversion for a pivot table, summary spreadsheet and graphs.