Excel Copy value from cell with custom format


/ Published in: Visual Basic
Save to your folder(s)

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


Copy this code and paste it in your HTML
  1. Sub valueWithoughtFormat()
  2. For Each r In Selection
  3. r.Value = Chr(39) & r.Text
  4. Next
  5. End Sub

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.