Nuz
06-03-2011, 12:09 AM
I upgraded from Excel 2002 to 2010 and the VBA code I use cannot anymore convert the numbers stored as text to numbers. I use the technique by multiplying the text values with 1, like below:
Range("IV1").NumberFormat = "General"
Range("IV1").Value = "1"
Range("IV1").Copy
Range(Cells(2, 24), Cells(10000, 26)).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlMultiply, SkipBlanks:=True, Transpose:=False
The original data comes from a database and therefore the numbers seems to be stored as text. The problem is only with the numbers that have a comma (,), like 14,5. With integers there is no such problem.
Is there some problem with the above VBA code since if I make the same operation manually (copy the 1 and pastespecial as value with multiply operation) it works perfectly.
Range("IV1").NumberFormat = "General"
Range("IV1").Value = "1"
Range("IV1").Copy
Range(Cells(2, 24), Cells(10000, 26)).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlMultiply, SkipBlanks:=True, Transpose:=False
The original data comes from a database and therefore the numbers seems to be stored as text. The problem is only with the numbers that have a comma (,), like 14,5. With integers there is no such problem.
Is there some problem with the above VBA code since if I make the same operation manually (copy the 1 and pastespecial as value with multiply operation) it works perfectly.