Hi all,
I'm trying to write code that converts a range of numeric values to string values, e.g. the number 123.456 to the string 123.456. I have tried using the cstr function to do this, but it doesn't seem to work. I find that my converted values are still numeric. Suppose I have 20 numbers in the range A1:A20, and I'd like these to be converted to strings and placed in the range B1:B20. This is the code I am using:
I'd expect the range B1:B20 to contain the string equivalents of the numbers in A1:A20, but this is not the case. What I find is that B1:B20 is the same A1:A20, i.e. using the =isnumber worksheet function verifies that both columns have numeric values.![]()
Option Explicit Sub ConvertToString() Dim i As Integer For i = 1 To 20 Cells(i, 2).Value = CStr(Cells(i, 1).Value) Next 'i End Sub
Any idea what I am doing wrong?
Many thanks,
I.
Bookmarks