Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Excel VBA Loop to Convert Text to Number

Avatar of jobprojn
jobprojnFlag for United States of America asked on
Microsoft OfficeMicrosoft Excel
5 Comments1 Solution1134 ViewsLast Modified:
Hello Experts.  I am trying to write some Excel VBA to loop through a some rows and convert the text to a number.

I need the code to start with AD11:AH11 and then repeat for every third row thereafter until there's no more rows.

My below code works for AD11:AH11 but it stops there.  It's not running every third row.

Any help is greatly appreciated.  Thanks.
Sub TextToNumber3()

Dim rngMyRange As Range
Dim row As Integer

    With Worksheets("Cycle Time")
        row = 11
        Set rngMyRange = .Range(.Range("AD" & row), .Range("AH" & row))

                For Each xCell In rngMyRange
                    rngMyRange.NumberFormat = "0" 'Note: use "0.00" for decimal places.
                    xCell.Value = xCell.Value
                    row = row + 3
                Next xCell
    End With

End Sub
Avatar of nutsch
This problem has been solved!
Unlock 1 Answer and 5 Comments.
See Answers