Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello,
I've got a column with Zip Codes in 12345-1234 format, but some zipcodes are in 12345 format. When the column is converted to text, those without dashes loose 0 in front of it. I wrote a macro to fix it. It suppose to check if the cell has less than 4 digits, and if so, add a 0 in front of it. It's not working - what is wrong with it ? Thanks! ------------------------------------------------- Sub ZipCodeFixer() Dim Zip1 As String Application.ScreenUpdating = False 'go to the first cell in the column Cells(2, 16).Select Do While Mid(ActiveCell, 5, 1) < "" If Mid(ActiveCell, 5, 1) = "" Then Zip1 = Mid(ActiveCell, 1, 4) ActiveCell.FormulaR1C1 = "'" + Zip1 End If ActiveCell.Offset(1, 0).Select Loop Application.ScreenUpdating = True End Sub ---------------------------------------------------------------- |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How add a digit to front of number in each cell in excexl column | Excel Discussion (Misc queries) | |||
put 0 in front of number | Excel Discussion (Misc queries) | |||
Creating zero's in front of number and after number | Excel Discussion (Misc queries) | |||
Get number of different values in a column | Excel Programming | |||
zero in front of a number | Excel Discussion (Misc queries) |