Consulting

Results 1 to 3 of 3

Thread: Solved: Clear cells in column A if column B has a zero

  1. #1
    VBAX Expert Shazam's Avatar
    Joined
    Sep 2005
    Posts
    530
    Location

    Solved: Clear cells in column A if column B has a zero

    I have part numbers in column A and column B has the qty's. Does someone have a code if any cells in column B has a zero then clear the cells next to column A?
    SHAZAM!

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]

    Public Sub ProcessData()
    Const TEST_COLUMN As String = "B" '<=== change to suit
    Dim i As Long
    Dim iLastRow As Long
    With ActiveSheet

    iLastRow = .Cells(.Rows.Count, TEST_COLUMN).End(xlUp).Row
    For i = 1 To iLastRow
    If .Cells(i, TEST_COLUMN).Value = 0 Then
    .Cells(i, TEST_COLUMN).Offset(0, -1).Value = ""
    End If
    Next i
    End With

    End Sub
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Expert Shazam's Avatar
    Joined
    Sep 2005
    Posts
    530
    Location
    Thank You xld it's perfect!!
    SHAZAM!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •