Skip to content

Instantly share code, notes, and snippets.

@philbritton
Created April 1, 2014 00:45
Show Gist options
  • Save philbritton/9905578 to your computer and use it in GitHub Desktop.
Save philbritton/9905578 to your computer and use it in GitHub Desktop.
macro to change data type for crm extracts
Sub CrmConvertFields()
'
' CrmConvertFields Macro
'
Dim txt As String
Dim num As Double
For Each Cell In Selection.Cells
txt = Cell.Value
txt = Replace(txt, "$", "")
txt = Replace(txt, ",", "")
If Len(txt) > 0 Then
Dim txtNum As String
txtNum = Right(txt, Len(txt) - 1)
If (IsNumeric(txtNum)) Then
Cell.Value = Val(txtNum)
End If
If (IsDate(txt)) Then
Cell.Value = DateValue(txt)
End If
End If
Next
'
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment