'Using VBA .NumberFormat is there a way to format an entire column as a Zip Code?
I am trying to format an entire column as a zip code with VBA. I know this can be done by selecting Special --> Zip Code from the numbers drop down. Is this something that the .NumberFormat function supports in VBA?
I tried this with no luck:
Sheets("Sheet1").Columns(2).NumberFormat = "Zip Code"
Solution 1:[1]
This is what the macro recorder produces:
Sub Makro1()
'
' Makro1 Makro
'
'
Range("E4").Select
Selection.NumberFormat = "00000"
End Sub
Solution 2:[2]
I had forgotten about using macro recorder and found this through my own searching.
This is what the current macro record produces:
Columns("AD:AD").Select
Selection.NumberFormat = "00000"
The original answer did not work for me.
Sheets("Sheet1").Columns(2).NumberFormat = "00000"
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Vityata |
| Solution 2 | Travis |
