ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro acting wierd with Zip Codes (https://www.excelbanter.com/excel-programming/397424-macro-acting-wierd-zip-codes.html)

Stick With Hair

Macro acting wierd with Zip Codes
 
I'm trying to store zip codes in a spreadsheet but am getting issues
with items that start with a 0.

The code I am using is:

<BCells(1,15) = "06555"</B

The end result is showing up as 6555 in Excel - how do I get it to
show 06555?


Tom Ogilvy

Macro acting wierd with Zip Codes
 
<BCells(1,15) = "'06555"</B

note added single quote.

--
Regards,
Tom Ogilvy


"Stick With Hair" wrote:

I'm trying to store zip codes in a spreadsheet but am getting issues
with items that start with a 0.

The code I am using is:

<BCells(1,15) = "06555"</B

The end result is showing up as 6555 in Excel - how do I get it to
show 06555?



Dave Peterson

Macro acting wierd with Zip Codes
 
Another:

With activesheet.cells(1,15)
.numberformat = "@" 'text
.value = "06555"
End with

Stick With Hair wrote:

I'm trying to store zip codes in a spreadsheet but am getting issues
with items that start with a 0.

The code I am using is:

<BCells(1,15) = "06555"</B

The end result is showing up as 6555 in Excel - how do I get it to
show 06555?


--

Dave Peterson


All times are GMT +1. The time now is 10:14 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com