Custom Format Data inside a Cell  
Author Message
LDeLeon





PostPosted: Visual Basic for Applications (VBA), Custom Format Data inside a Cell Top

I have a column of numbers in the following format:

(###) ###-####

and I would like to write a macro that changes the previous format to the following:

[fax: (###) ###-###]

where the text "[fax:" is added at the beginning and a closing bracket "]" at the end.

Could you offer help on creating this macro, or other suggestions on how to fix this in Excel

Thank you!



Microsoft ISV Community Center Forums1  
 
 
rusty coder





PostPosted: Visual Basic for Applications (VBA), Custom Format Data inside a Cell Top

If what you specied for the format is a custom format, change it to:

"[fax: "(###) ###-####"]" (including all double-quotes)

If the non-numeric formating elements are data in the cell use this macro:

Sub AddFax()
Selection.Value = "[fax: " & Selection.Value & "]"
End Sub

I would set up a keyboard shortcut for this to make life a little easier.

rusty


 
 
LDeLeon





PostPosted: Visual Basic for Applications (VBA), Custom Format Data inside a Cell Top

Thank you very much! This worked. I appreciate yourh elp.