from num to text - end sub

  • Thread starter Thread starter יריב החביב
  • Start date Start date
×

יריב החביב

Hello,

We have this code to transform data from num to text

I want to exit this code (loop) when there are no more value's in the column
(empty)

what do i have to edit to that code ?

Range("H1:H5200").Select
Selection.NumberFormat = "@"

Dim cell As Object
For Each cell In Selection
cell.Value = " " & cell.Value
cell.Value = Right(cell.Value, Len(cell.Value) - 1)
Next
 
Dim cell As Object

Range("H1:H5200").NumberFormat = "@"
For Each cell In Range("H1:H5200")
If cell.Value <> "" Then

cell.Value = Right(cell.Value, Len(cell.Value) - 1)
Else

Exit For
End If
Next cell
 
thank you Bob, but it make all the range as 'text'
 
This line formats the entire range as text:
Range("H1:H5200").NumberFormat = "@"

If you only want to format the cells that are changed to text:
 

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

Similar Threads


Back
Top