troubleshooting Question

Excel VBA Loop to Convert Text to Number

Avatar of jobprojn
jobprojnFlag for United States of America asked on
Microsoft ExcelMicrosoft Office
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
Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros