Posted By

abhisood on 02/16/11


format copy Value excel cell special

Versions (?)

Who likes this?

1 person have marked this snippet as a favorite


Excel Copy value from cell with custom format

 / Published in: Visual Basic

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

  1. Sub valueWithoughtFormat()
  2. For Each r In Selection
  3. r.Value = Chr(39) & r.Text
  4. Next
  5. End Sub

Report this snippet  

You need to login to post a comment.