ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Make a cell value include number formats (https://www.excelbanter.com/excel-programming/339144-make-cell-value-include-number-formats.html)

Djmask[_11_]

Make a cell value include number formats
 

I am trying to file append a phone number in excel with the number
format I designate. However when I append the cell to a new file it
doesn't include my number format. How can I accomplish this?

Cell Value

5552879898

Cell NumberFormat

###-###-####

Cell Value Display in Excel

555-287-9898

File Append Cell Value

5552879898

The following code only makes it appear in excel the way it should.


Code:
--------------------
Columns("R:R").Select
Selection.NumberFormat = "###-###-####"

--------------------


Thanks for any help.

Scott


--
Djmask
------------------------------------------------------------------------
Djmask's Profile: http://www.excelforum.com/member.php...o&userid=24414
View this thread: http://www.excelforum.com/showthread...hreadid=401726


Dave Peterson

Make a cell value include number formats
 
If you are using append to mean concatenate:

=a1&" "&text(a2,"000-000-0000")

If you're writing code to append to a file, you could write the formatted
string:

print #1, format(phonevariable,"000-000-0000")

or if you're picking it up from the cell:

Print #1, worksheets("sheet1").range("a1").text

(only if that cell were formatted correctly.)


Djmask wrote:

I am trying to file append a phone number in excel with the number
format I designate. However when I append the cell to a new file it
doesn't include my number format. How can I accomplish this?

Cell Value

5552879898

Cell NumberFormat

###-###-####

Cell Value Display in Excel

555-287-9898

File Append Cell Value

5552879898

The following code only makes it appear in excel the way it should.

Code:
--------------------
Columns("R:R").Select
Selection.NumberFormat = "###-###-####"

--------------------


Thanks for any help.

Scott

--
Djmask
------------------------------------------------------------------------
Djmask's Profile: http://www.excelforum.com/member.php...o&userid=24414
View this thread: http://www.excelforum.com/showthread...hreadid=401726


--

Dave Peterson

Djmask[_12_]

Make a cell value include number formats
 

Thank you Dave,
You came up huge. This was the last step in a big process.


--
Djmask
------------------------------------------------------------------------
Djmask's Profile: http://www.excelforum.com/member.php...o&userid=24414
View this thread: http://www.excelforum.com/showthread...hreadid=401726



All times are GMT +1. The time now is 12:13 AM.

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