T
Tomski
Hi,
I have made a macro that copies data from a number of sheets into
main one. One of the columns in the main sheet contains numbers to b
used in a vlookup. The problem is that when some of the numbers ar
copied across to the main sheet they remain in text format, as the
were stored in this format on the source sheet.
Once all the copying is done I need to make sure that all numbers in
certain column are stored as numbers. I tried the following, howeve
the line,
MyCell.Value = CInt(MyCell.Value) caused an error. Is this the way t
do this, i.e type casting, and if so why does this not work. Or i
there a better way, maybe something that works on the whole range a
opposed to each cell individually?
Set MyCell = ActiveSheet.Range("C2")
Do While MyCell.Value <> ""
MyCell.Value = CInt(MyCell.Value)
Set MyCell = MyCell.Offset(1, 0)
Loop
Cheers,
To
I have made a macro that copies data from a number of sheets into
main one. One of the columns in the main sheet contains numbers to b
used in a vlookup. The problem is that when some of the numbers ar
copied across to the main sheet they remain in text format, as the
were stored in this format on the source sheet.
Once all the copying is done I need to make sure that all numbers in
certain column are stored as numbers. I tried the following, howeve
the line,
MyCell.Value = CInt(MyCell.Value) caused an error. Is this the way t
do this, i.e type casting, and if so why does this not work. Or i
there a better way, maybe something that works on the whole range a
opposed to each cell individually?
Set MyCell = ActiveSheet.Range("C2")
Do While MyCell.Value <> ""
MyCell.Value = CInt(MyCell.Value)
Set MyCell = MyCell.Offset(1, 0)
Loop
Cheers,
To