Look for text entries in specific column, move up one cell and delete that cell

Dear Experts:

I would like to achieve the following using VBA:

Go thru column B of the (used range of the ) active worksheet and look for text entries (numbers formatted as text do not count).
If found move up one cell and delete the contents of that cell. Do Loops.

Help is much appreciated. Thank you very much in advance.

Regards, Andreas

I have attached a sample file for your  convenience with detailed explanations.

Andreas HermleTeam leaderAsked:
Who is Participating?
krishnakrkcConnect With a Mentor Commented:


Sub kTest()

    Dim k, i As Long, cAddr As String, r As Range
    Const StartCell As String = "B7" '<<=== adjust this to suit
    Set r = Range(CStr(StartCell))
    k = Range(r, Cells(Rows.Count, r.Column).End(xlUp))
    For i = 2 To UBound(k, 1)
        If Not IsNumeric(k(i, 1)) Then
            cAddr = cAddr & "," & Cells(i - 1, 1).Address(0, 0)
            If Len(cAddr) > 240 Then
                r.Range(CStr(Mid$(cAddr, 2))).ClearContents
                cAddr = vbNullString
            End If
        End If
    If Len(cAddr) > 1 Then
        r.Range(CStr(Mid$(cAddr, 2))).ClearContents
    End If

End Sub

Andreas HermleTeam leaderAuthor Commented:
Hi Kris,

great job. Works like a charm. Thank you very much for your professional help. Regards,  Andreas
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.