Convert a number formatted as text to a number in a macro

M

MACRE0

Anyone have a simple macro that converts a number in a cell that was
formatted as text or proceeded by an apostrophe?

Or a work around
Coverting " 12345 - xyz"

Selection.Copy
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveSheet.Paste
ActiveCell.Offset(0, -1).Range("A1").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=MID(RC[1],3,7)"
ActiveCell.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues

to "12345" such that a vlookup can then match this to "12345" that's
formatted as a number already.

Thanks for any and all help!
 
T

Tom Ogilvy

If '12345

is in the active Cell

Sub aaa()
ActiveCell.NumberFormat = "General"
ActiveCell.Value = ActiveCell.Value

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top