JenniferMurphy
Well-known Member
- Joined
- Jul 23, 2011
- Messages
- 2,535
- Office Version
- 365
- Platform
- Windows
I have a bunch of sheets with columns of data. Two of the columns contain ratings, such as "Mint", "Near Mint", "Very Good Plus", "Very Good", etc. There are 9 ratings in all.
As they are, those columns can only be sorted alphabetically, which is not that helpful. My solution is to write a macro that will find those columns and add a number prefix that will allow useful sorting. The conversions are:
I have 2 questions:
1. I know I can define those columns as a named range, but that's a pain to have to do every time I create a new sheet. Is there a way I can have the Sub scan the first couple of rows. If it finds one of the old terms, it will then convert it and then scan down that column until it runs out of data. (Several hundred rows.)
2, Is there a better way to do the conversion that a Case statement:
Thanks
As they are, those columns can only be sorted alphabetically, which is not that helpful. My solution is to write a macro that will find those columns and add a number prefix that will allow useful sorting. The conversions are:
I have 2 questions:
1. I know I can define those columns as a named range, but that's a pain to have to do every time I create a new sheet. Is there a way I can have the Sub scan the first couple of rows. If it finds one of the old terms, it will then convert it and then scan down that column until it runs out of data. (Several hundred rows.)
2, Is there a better way to do the conversion that a Case statement:
VBA Code:
Select Case UCase(pOld)
Case "MINT": CvtText = "1 Mint"
Case "NEAR MINT": CvtText = "2 Mint-"
Case "VERY GOOD PLUS": CvtText = "3 VGood+"
Case "VERY GOOD": CvtText = "4 VGood"
Case "GOOD PLUS": CvtText = "5 Good+"
Case "GOOD": CvtText = "6 Good"
Case "FAIR": CvtText = "7 Fair"
Case "POOR": CvtText = "8 Poor"
Case "NO COVER": CvtText = "9 None"
Case Else: CvtText = "????"
End Select
Thanks