+ Reply to Thread
Results 1 to 24 of 24

change macro to delete values in rows

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

    change macro to delete values in rows

    Hello everyone,
    This macro is used to elimiare values of a selected row from column B to H
    leaving unchanged the values in column A.

    Please Login or Register  to view this content.
    Chiedo un aiuto per una modifica.

    Selezionare più di una riga

    spero di essere stato comprensibile.
    Grazie,
    max_max


    I ask help for a change.

    Select more than one row

    I hope I was understood.
    thanks,
    max_max

  2. #2
    Valued Forum Contributor Kamboj's Avatar
    Join Date
    09-25-2014
    Location
    India
    MS-Off Ver
    2003 - 2010
    Posts
    430

    Re: change macro to delete values in rows

    you can use
    Please Login or Register  to view this content.
    or use your last desire row

  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: change macro to delete values in rows

    Thanks Kamboj of fast response.
    Your solution is o.k.
    But if you must remove 2 or 30 rows as you do?
    max_max
    -----------------------------------------------------
    Grazie kamboj della veloce risposta.
    La tua soluzione è o.k.
    Ma se deve eliminare 2 oppure 30 righe come si fa?
    max_max

  4. #4
    Valued Forum Contributor Kamboj's Avatar
    Join Date
    09-25-2014
    Location
    India
    MS-Off Ver
    2003 - 2010
    Posts
    430

    Re: change macro to delete values in rows

    Sir I cann't understand how many rows you want to clear if your last row number is definite then you use that with + or if you want to get last row number then you can use - Cells(Rows.Count, "B").End(xlUp).Row with a variable and use that variable at the last like this
    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: change macro to delete values in rows

    It is not correct.
    Selecting a row deletes all rows
    max_max

  6. #6
    Valued Forum Contributor Kamboj's Avatar
    Join Date
    09-25-2014
    Location
    India
    MS-Off Ver
    2003 - 2010
    Posts
    430

    Re: change macro to delete values in rows

    Sir can you upload the file with example what is your requirement.

  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: change macro to delete values in rows

    I hope it is understandable.
    Attached Files Attached Files
    Last edited by max_max; 06-13-2015 at 07:40 AM.

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

    Re: change macro to delete values in rows

    Modified
    Modificato

    cancella più di 1 riga_new.xls

  9. #9
    Valued Forum Contributor Kamboj's Avatar
    Join Date
    09-25-2014
    Location
    India
    MS-Off Ver
    2003 - 2010
    Posts
    430

    Re: change macro to delete values in rows

    sir here is code
    Please Login or Register  to view this content.

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

    Re: change macro to delete values in rows

    No it is still wrong,
    the macro should only delete the selected rows
    --------------------------------------------------
    No è ancora sbagliato.
    La macro deve eliminare solo le righe selezionate

  11. #11
    Valued Forum Contributor Kamboj's Avatar
    Join Date
    09-25-2014
    Location
    India
    MS-Off Ver
    2003 - 2010
    Posts
    430

    Re: change macro to delete values in rows

    Sir, I think this is the result you need.
    Attached Files Attached Files

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

    Re: change macro to delete values in rows

    No it is still wrong,
    the macro should only delete the selected rows
    -----------------------------------------------------------------------------------------
    No è ancora sbagliato.
    La macro deve eliminare solo le righe selezionate

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

    Re: change macro to delete values in rows

    No it is still wrong,
    the macro should only delete the selected rows
    It is written in the sample file Answer # 8
    -----------------------------------------------------------------------------------------
    No è ancora sbagliato.
    La macro deve eliminare solo le righe selezionate
    è scritto nella rispota #8

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

    Re: change macro to delete values in rows

    No it is still wrong,
    the macro should only delete the selected rows
    It is written in the sample file Answer # 8
    -----------------------------------------------------------------------------------------
    No è ancora sbagliato.
    La macro deve eliminare solo le righe selezionate
    è scritto nel file di esempio nella risposta #8

  15. #15
    Valued Forum Contributor Kamboj's Avatar
    Join Date
    09-25-2014
    Location
    India
    MS-Off Ver
    2003 - 2010
    Posts
    430

    Re: change macro to delete values in rows

    Sir you only want to delete data of row no. 3 only or what are selected.

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

    Re: change macro to delete values in rows

    Unfortunately, not knowing English well is difficult to explain.
    The macro must delete the data of the rows that are selected with the mouse.
    If rows are selected 3/4/5 the macro should only delete these rows,
    not the subsequent rows.
    ----------------------------------------------------------------------------------
    Putroppo non conoscendo bene l'inglese è difficile spiegarmi.
    La macro deve eliminare i dati delle righe che vengono selezionate con il mouse.
    Se vengono selezionate le righe 3/4/5 la macro deve eliminare solo queste righe,
    non le righe successive.

  17. #17
    Valued Forum Contributor Kamboj's Avatar
    Join Date
    09-25-2014
    Location
    India
    MS-Off Ver
    2003 - 2010
    Posts
    430

    Re: change macro to delete values in rows

    Sir, This is your requirement:-


    Please Login or Register  to view this content.

  18. #18
    Valued Forum Contributor Kamboj's Avatar
    Join Date
    09-25-2014
    Location
    India
    MS-Off Ver
    2003 - 2010
    Posts
    430

    Re: change macro to delete values in rows

    Sir in previous coding we select col a not row but in the above coding we select rows. Some misunderstanding.
    Hope this will be right.

  19. #19
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,525

    Re: change macro to delete values in rows

    Hi max_max,

    Not sure why you select the row before clearing the contents from columns B and H, but this will do what you're after:

    Please Login or Register  to view this content.
    Regards,

    Robert
    ____________________________________________
    Please ensure you mark your thread as Solved once it is. Click here to see how
    If this post helps, please don't forget to say thanks by clicking the star icon in the bottom left-hand corner of my post

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

    Re: change macro to delete values in rows

    Thanks Kamboj now works well.
    Thanks also to trebor76 also your macro works.
    max_max
    --------------------------------------------------------
    Grazie kamboj ora funziona bene.
    Un grazie anche a trebor76 anche la tua macro funziona.
    max_max

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

    Re: change macro to delete values in rows

    For Kamboj.
    Hello Kamboj your macro works well almost.

    Please Login or Register  to view this content.
    If I select for example the rows starting from 5/6/7/8 deletes all rows,
    if I select the rows starting from 8/7/6/5 deletes only the row 8.
    Can be corrected?
    I hope I explained.
    max_max

    ----------------------------------------------------------------------------

    Per kamboj.
    Ciao Kamboj la tua macro funziona quasi bene.
    Se seleziono per esempio le righe partendo da 5/6/7/8 elimina tutte le righe,
    se seleziono le righe patendo da 8/7/6/5 elimina solo la riga 8.
    E' possibile correggere?
    Spero di essermi spiegato.
    max_max

  22. #22
    Valued Forum Contributor Kamboj's Avatar
    Join Date
    09-25-2014
    Location
    India
    MS-Off Ver
    2003 - 2010
    Posts
    430

    Re: change macro to delete values in rows

    Sir
    just change this line in macro
    Please Login or Register  to view this content.

  23. #23
    Valued Forum Contributor Kamboj's Avatar
    Join Date
    09-25-2014
    Location
    India
    MS-Off Ver
    2003 - 2010
    Posts
    430

    Re: change macro to delete values in rows

    actually it gets activecell row number which is 8 when you select from below to up line so it clear only that row basically we need selection rows numbers whatsever it is select from above to down or below to up.

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

    Re: change macro to delete values in rows

    Thanks Kamboj now is ok.
    max_max

+ 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. Replies: 4
    Last Post: 08-12-2013, 01:35 PM
  2. [SOLVED] Help with macro to delete rows based on values
    By jimstrongy in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 04-26-2012, 08:49 AM
  3. [SOLVED] Macro to Delete Rows and Change Cell Values
    By boldcode in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-08-2011, 04:41 PM
  4. Macro to delete rows containing values
    By mohan_rajun in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-12-2010, 07:30 AM
  5. macro to delete rows with a range for values
    By poole in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 03-28-2009, 02:18 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