Return to Snippet

Revision: 41341
at February 16, 2011 10:56 by abhisood

Initial Code
Sub valueWithoughtFormat()
    For Each r In Selection
        r.Value = Chr(39) & r.Text
End Sub

Initial URL

Initial Description
Excel macro to copy values from formated cells. For example:

If you have a sheet that has huge numbers in millions for example 1,312,323 and you apply a format to the cell such that only 1.3 is displayed, if you want to copy 1.3 and put it in a database (without the format) use the following snippet.

Select all the cells you want to apply this macro and run it.

Note: this will convert the cell values to string

Initial Title
Excel Copy value from cell with custom format

Initial Tags
format, copy, excel

Initial Language
Visual Basic