I have 2 columns that I am combing via VBA, the first column contains invoice numbers that are 7 digits long and the second column contains part numbers that are 12 digits long and contain a "-" and a "*". Everything works fine until I remove the "-" and the "*", I get a bunch of "#"'s and if I convert the column to text I get a scientific notation. I know that if I was manually typing in the cell I could add " ' ", but how do I do that, or similar, via VBA.
Code:
Range("Table1[Lookup]").NumberFormat = "Text"
Range("Table1[Lookup]").FormulaLocal = "=[@InvoiceNumber]&[@PartNumber]"
Range("Table1[Lookup]").Copy
Range("Table1[Lookup]").PasteSpecial Paste:=xlPasteValues
Range("Table1[Lookup]").NumberFormat = "Text"
Range("Table1[Lookup]").Select
Selection.Replace What:="~*", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Range("Table1[Lookup]").Select
Selection.Replace What:="-", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False