+ Reply to Thread
Results 1 to 4 of 4

delete row

  1. #1
    Registered User
    Join Date
    05-30-2006
    Posts
    17

    Unhappy delete row

    If cell A4 has a value of 0. I am looking for the entire row to be deleted.
    Please help

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    You will need VBA Code

    Try this. Press Alt + F11. Insert module then paste in the below code.
    Press alt F8 and run Delete_row.

    See attched to make it a event procedure e.g If someone enters 0 in cell A4 it will delete row automatically

    http://www.cpearson.com/excel/events.htm

    Sub Delete_row()

    Dim Rng1 As Range
    Set Rng1 = Range("A4")

    If Rng1.Value = 0 Then
    Rows("4:4").Delete Shift:=xlUp
    End If

    End Sub

    VBA Noob

  3. #3
    Sasa Stankovic
    Guest

    Re: delete row

    or:
    in VBA:
    Sub row()
    If Range("A4").Value = 0 Then
    Selection.EntireRow.Delete
    ActiveCell.Offset(RowOffset:=-1, ColumnOffset:=0)
    End If
    End Sub

    "VBA Noob" <[email protected]> wrote in
    message news:[email protected]...
    >
    > You will need VBA Code
    >
    > Try this. Press Alt + F11. Insert module then paste in the below code.
    > Press alt F8 and run Delete_row.
    >
    > See attched to make it a event procedure e.g If someone enters 0 in
    > cell A4 it will delete row automatically
    >
    > http://www.cpearson.com/excel/events.htm
    >
    > Sub Delete_row()
    >
    > Dim Rng1 As Range
    > Set Rng1 = Range("A4")
    >
    > If Rng1.Value = 0 Then
    > Rows("4:4").Delete Shift:=xlUp
    > End If
    >
    > End Sub
    >
    > VBA Noob
    >
    >
    > --
    > VBA Noob
    > ------------------------------------------------------------------------
    > VBA Noob's Profile:
    > http://www.excelforum.com/member.php...o&userid=33833
    > View this thread: http://www.excelforum.com/showthread...hreadid=564434
    >




  4. #4
    Registered User
    Join Date
    05-30-2006
    Posts
    17

    delet row

    nothing seemed to work.
    If a 0 is in A4 I need to at least have the contents of cells A4,B4,C4,D4,E4,F4 be deleted also.


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1