Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Re-formatting excel spreadsheet...possibly w/ macros

Status
Not open for further replies.

mtaghap

IS-IT--Management
Aug 12, 2002
6
US
I received several Excel sheets w/ our product id's. The problem is that the naming convention is not formatted exactly like ours. I can change it, but there's just too many entries (about 2500 product id's per worksheet).
For example: Our distributors worksheet has a column that displays our product id# as 15-0011306400. In fact, all of the product id's that they sent to us has a "15" in front of the actual product id. Our product id format is xxx-xxxxx-xx without the "15" in the front, but with hyphens. So it should show 001-13064-00. Like I said, the "15" in the front is not part of our naming convention.
Any help or ideas is greatly appreciated!
 
you would need to highlight the cells that you need formatted to use this macro

Sub numfmt()
Dim currentcell As Object
For Each currentcell In Selection
currentcell.Value = Val(Right(currentcell.Value, 10))
currentcell.NumberFormat = "000-00000-00"
Next currentcell
End Sub
 
Thanks Onedtent! This did the trick. I also had to manipulate the formula for different formats. Is there a book of formulas for Excel? What is the title?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top