+ Reply to Thread
Results 1 to 10 of 10

delete rows automatic

  1. #1
    Forum Contributor max_max's Avatar
    Join Date
    06-28-2013
    Location
    italy - venice
    MS-Off Ver
    Excel 2007
    Posts
    1,693

    delete rows automatic

    Hi everyone,
    it is possible when entering a value in the cell A5005 the values of rows A6 to A1006 are deleted
    max
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor rollis13's Avatar
    Join Date
    01-26-2012
    Location
    Cordenons
    MS-Off Ver
    Excel 2016 32bit - Win 11
    Posts
    935

    Re: delete rows automatic

    Place this macro in the sheets vbe module, it will do what you're asking for.
    Please Login or Register  to view this content.
    Last edited by rollis13; 01-11-2021 at 07:51 PM.

  3. #3
    Forum Contributor max_max's Avatar
    Join Date
    06-28-2013
    Location
    italy - venice
    MS-Off Ver
    Excel 2007
    Posts
    1,693

    Re: delete rows automatic

    Hi rollis13 thanks you.
    Your macro it works almost well.
    now it deletes the lines but it must not delete them, it must only delete the content.
    I modified it like this:
    Please Login or Register  to view this content.
    but the empty lines remain at the top.
    after deletion, the remaining lines must be brought up to the same position in top
    I hope I have explained
    max

  4. #4
    Valued Forum Contributor rollis13's Avatar
    Join Date
    01-26-2012
    Location
    Cordenons
    MS-Off Ver
    Excel 2016 32bit - Win 11
    Posts
    935

    Re: delete rows automatic

    the values of rows A6 to A1006 are deleted
    That's exactly what you asked for, you didn't ask for Clearing the cells.
    To avoid empty rows at the top you can have a try this other version of the macro, fix the ranges if necessary:
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor max_max's Avatar
    Join Date
    06-28-2013
    Location
    italy - venice
    MS-Off Ver
    Excel 2007
    Posts
    1,693

    Re: delete rows automatic

    Hi rollis it's o.k. now there is a problem
    the data in the "valori" sheet is inserted by another macro
    and then with the macro
    Private Sub Worksheet_Change(ByVal Target As Range)
    does not work
    Attached Files Attached Files

  6. #6
    Valued Forum Contributor rollis13's Avatar
    Join Date
    01-26-2012
    Location
    Cordenons
    MS-Off Ver
    Excel 2016 32bit - Win 11
    Posts
    935

    Re: delete rows automatic

    The macro in the attached file (post #5) works as required, so ... how do you expect someone who doesn't know your project to make some other diagnosis, so blindly ? What does this other macro do ? how does it work ? where is it placed ?

  7. #7
    Forum Contributor max_max's Avatar
    Join Date
    06-28-2013
    Location
    italy - venice
    MS-Off Ver
    Excel 2007
    Posts
    1,693

    Re: delete rows automatic

    Is it not possible for the sheet to update even if it is not open?

  8. #8
    Valued Forum Contributor rollis13's Avatar
    Join Date
    01-26-2012
    Location
    Cordenons
    MS-Off Ver
    Excel 2016 32bit - Win 11
    Posts
    935

    Re: delete rows automatic

    Impossible, some sort of access must be done if changes need to be made.

  9. #9
    Forum Contributor max_max's Avatar
    Join Date
    06-28-2013
    Location
    italy - venice
    MS-Off Ver
    Excel 2007
    Posts
    1,693

    Re: delete rows automatic

    Hello,
    excuse my ignorance but it can be replaced

    Private Sub Worksheet_Change(ByVal Target As Range)

    with

    Private Sub Worksheet_Activate()

    i tried but it gives error here

    If Target.Cells.Count > 1 Then Exit Sub

  10. #10
    Valued Forum Contributor rollis13's Avatar
    Join Date
    01-26-2012
    Location
    Cordenons
    MS-Off Ver
    Excel 2016 32bit - Win 11
    Posts
    935

    Re: delete rows automatic

    No, you can't do that, they are different events, Worksheet_Activate triggers only once when you change sheet while Worksheet_Change triggers when you manually change the contents of a cell (the Target) and its value/address/content is available within the macro (ByVal Target As Range).

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Rows delete formula as per range of cell values with counter to delete # rows
    By qureshi2016 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-03-2017, 09:35 AM
  2. [SOLVED] macro to automatic delete same row
    By oeyandyprawira in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-19-2016, 05:59 AM
  3. [SOLVED] Automatic row delete
    By romandotcom in forum Excel General
    Replies: 5
    Last Post: 04-08-2014, 02:37 AM
  4. [SOLVED] How to delete rows automatic having no value in a column ?
    By PRADEEPB270 in forum Excel General
    Replies: 3
    Last Post: 09-21-2013, 04:35 AM
  5. [SOLVED] Please, I need to automatic delete rows
    By sergiows in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-16-2012, 08:49 AM
  6. Replies: 4
    Last Post: 11-24-2005, 04:40 PM
  7. Replies: 1
    Last Post: 05-19-2005, 07:06 PM

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