Avatar of AccountantsTech
AccountantsTech

asked on 

Excel VBA Number Format

I am having a problem with the number format for cell that is being cleared with VBA and then a raw report from Quickbooks is imported.  

The problem happens when a value with a leading zero is imported as a number.  For example: account number "0123456" is imported as "123456".  

I am stumped with how to force the formatting to be "Text" so that the number shows right.  At first glance this might seam like a simple line to format the data to text before it is placed on the worksheet would fix this but the report is simply being deposited into the sheet without addressing each value.  

Thanks for your help.
Microsoft Excel

Avatar of undefined
Last Comment
AccountantsTech
ASKER CERTIFIED SOLUTION
Avatar of Michael Fowler
Michael Fowler
Flag of Australia image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of AccountantsTech
AccountantsTech

ASKER

I actually just went around this issue by running a post import routine that checks the length of the value and adds a leading zero if it is shorter.  All values should be 6 characters long.

Thank you for you help!
Microsoft Excel
Microsoft Excel

Microsoft Excel topics include formulas, formatting, VBA macros and user-defined functions, and everything else related to the spreadsheet user interface, including error messages.

144K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo