Excel macro, loop thru entire column/all rows

folks the below looks at column/row a1 and in colum b1 gives and output

how do i get it to do the same for the entire colum a's values and display for column b?

all help will do

Private Sub TestGetStatus()
    GetStatus "A1"
End Sub

Sub GetStatus(ByVal Ref As String)

    Dim HttpReq As Object
    Dim Rslt As Variant
   
    Set HttpReq = CreateObject("MSXML2.XMLHTTP")
   
    On Error Resume Next
    With HttpReq
        .Open "GET", ActiveSheet.Range(Ref).Value, False
        .Send
        If Err Then
            Rslt = "No connection"
        Else
            Rslt = Val(.Status)
            If Err Then
                Rslt = "No Response"
            Else
                Rslt = "Status: " & Rslt
            End If
        End If
    End With
    ActiveSheet.Range(Ref).Offset(0, 1).Value = Rslt
End Sub
rutgermonsAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

drfrank319Commented:
Try this:

Private Sub TestGetStatus()
    Dim startRow As Integer
    Dim col As Integer
    startRow = 1
    col = 1
    Call GetStatus(startRow, col)
End Sub

Sub GetStatus(startRow As Integer, col As Integer)
    Dim row As Integer
    Dim usedRowRange As Integer
    Dim HttpReq As Object
    Dim Rslt As Variant
   
   usedRowRange = ActiveSheet.UsedRange.Rows.Count
    Set HttpReq = CreateObject("MSXML2.XMLHTTP")
   
    For row = startRow To usedRowRange
        On Error Resume Next
        With HttpReq
            .Open "GET", ActiveSheet.Cells(row, col).Value, False
            .Send
            If Err Then
                Rslt = "No connection"
            Else
                Rslt = Val(.Status)
                If Err Then
                    Rslt = "No Response"
                Else
                    Rslt = "Status: " & Rslt
                End If
            End If
        End With
        ActiveSheet.Cells(row, col + 1).Value = Rslt
    Next
End Sub
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.