+ Reply to Thread
Results 1 to 30 of 30

delete row

  1. #1
    Forum Contributor
    Join Date
    10-31-2018
    Location
    venezia
    MS-Off Ver
    2007
    Posts
    487

    delete row

    Hi to all
    In the attached workbook in sheet "articoli"

    select a row from 6 down
    click "delete row" button the row content is deleted

    help with this change:

    "nuovo articolo " sheet enter a value in cell D4
    click "delete row" button the row content in "articles" sheet is deleted

    I hope to be explained
    thanks
    john
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    06-27-2010
    Location
    sYRIA
    MS-Off Ver
    Excel 2013
    Posts
    669

    Re: delete row

    Hi
    Try
    Please Login or Register  to view this content.

  3. #3
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,213

    Re: delete row

    Please try

    Please Login or Register  to view this content.
    Attached Files Attached Files

  4. #4
    Forum Contributor tax112's Avatar
    Join Date
    02-28-2013
    Location
    Thailand
    MS-Off Ver
    Excel 2016 | 2019
    Posts
    438

    Re: delete row

    Try
    HTML Code: 

  5. #5
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,256

    Re: delete row

    click "delete row" button the row content in "articles" sheet is deleted
    As it is from dropdown...Assumes entry does exist
    Please Login or Register  to view this content.
    Last edited by sintek; 01-28-2021 at 05:48 AM.
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  6. #6
    Forum Contributor
    Join Date
    10-31-2018
    Location
    venezia
    MS-Off Ver
    2007
    Posts
    487

    Re: delete row

    Hi

    I added this but it doesn't work

    Please Login or Register  to view this content.



    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    10-31-2018
    Location
    venezia
    MS-Off Ver
    2007
    Posts
    487

    Re: delete row

    Not work here

    Please Login or Register  to view this content.



    Please Login or Register  to view this content.

  8. #8
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,256

    Re: delete row

    Have you tried any of the solutions provided...You seem to be just posting code that doesn't work...

  9. #9
    Forum Contributor
    Join Date
    10-31-2018
    Location
    venezia
    MS-Off Ver
    2007
    Posts
    487

    Re: delete row

    This his the workbook
    Attached Files Attached Files

  10. #10
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,256

    Re: delete row

    What are you actually wanting...

    Your first post says ... Clear the contents of the row that has the value AA123463 in articoli sheet...
    For this solutions were provided...Did you try any of these solutions...

  11. #11
    Forum Contributor
    Join Date
    10-31-2018
    Location
    venezia
    MS-Off Ver
    2007
    Posts
    487

    Re: delete row

    i am trying bo_ry solution which works
    i added this to work in another workbook

    Please Login or Register  to view this content.
    errore here

    If sComm2 = 0 Then

    error 13 mismatched type

  12. #12
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,256

    Re: delete row

    Don't get it...I'm outta here...good luck...

  13. #13
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,213

    Re: delete row

    You dim sComm2 as string, you need to compare with string

    if you need to compare with 0 don't dim sComm2 as string

    Just

    Dim sComm1, sComm2 'As String

  14. #14
    Forum Contributor
    Join Date
    10-31-2018
    Location
    venezia
    MS-Off Ver
    2007
    Posts
    487

    Re: delete row

    Thanks you bo_ry
    A greeting
    john

  15. #15
    Forum Contributor
    Join Date
    10-31-2018
    Location
    venezia
    MS-Off Ver
    2007
    Posts
    487

    Re: delete row

    Hi try in another workbook and the macro of bo_ry and tax111 not work.
    you can edit this macro in workbook post#1
    Please Login or Register  to view this content.
    change this

    not

    Nriga = ActiveCell.Row

    but

    in sheet nuovo articolo cell D4


    I hope I have explained
    thank you
    john

  16. #16
    Forum Contributor
    Join Date
    10-31-2018
    Location
    venezia
    MS-Off Ver
    2007
    Posts
    487

    Re: delete row

    I changed this:

    Please Login or Register  to view this content.
    error here

    Application.ScreenUpdating = False

    Nriga = SComm2 '<<<<<<<

    Application.EnableEvents = False

    mismatched type
    Attached Files Attached Files

  17. #17
    Forum Contributor
    Join Date
    10-31-2018
    Location
    venezia
    MS-Off Ver
    2007
    Posts
    487

    Re: delete row

    Hi to all
    I have edited the macro and it works
    I added a macro

    rimetti_formula

    to put the formulas back after deleting the rows.
    It is very slow.
    Is it possible to change to be faster?
    Attached Files Attached Files

  18. #18
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,256

    Re: delete row

    Doubt you going to get any results...You explained a requirement in post 1 which was solved...Since then all you have been doing in posting code that does not work and up to now...No further explanation of what it is you are actually trying to achieve...

    Perhaps if you explain with step by step explanation...someone might be able to offer a simplistic solution...

    Eg...

    I make a selection from drop down...
    Code must then go find that selection in other sheet
    Code must then clear the row
    Code must then .... etc etc etc

    Why are you deleting the formulas in that row anyway...Just clear the data leave formulas in tact
    Also why re-populate entire 5000 rows with formulas again
    You also only have data till row 2604???

    All this is slowing down your process...
    Last edited by sintek; 01-31-2021 at 05:30 AM.

  19. #19
    Forum Contributor
    Join Date
    10-31-2018
    Location
    venezia
    MS-Off Ver
    2007
    Posts
    487

    Re: delete row

    I choose a value in D4 "nuovo articolo" sheet
    if present row number in F4 (no 0)
    click on the "DELETE ROW" button
    the row in the "articoli" sheet is deleted from column B onwards
    the formulas in the "articoli" sheet are updated with the macro "rimetti_formula"
    the "rimetti_formula" macro is very slow, 2604 row to update
    I hope it is understandable
    john

  20. #20
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,256

    Re: delete row

    Why are you deleting the formulas in that row anyway...Just clear the data leave formulas in tact
    You are just overwriting the formulas with same formulas???

    Please Login or Register  to view this content.
    Last edited by sintek; 01-31-2021 at 05:53 AM.

  21. #21
    Forum Contributor
    Join Date
    10-31-2018
    Location
    venezia
    MS-Off Ver
    2007
    Posts
    487

    Re: delete row

    Thanks you sintek
    The your macro work.
    It is possible for my macro to add a change:
    this macro "rimetti formula" puts the formulas back in the whole range
    you can only put back formulas only for the deleted row
    Please Login or Register  to view this content.
    Attached Files Attached Files

  22. #22
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,256

    Re: delete row

    You don't need to...The code is not deleting the formulas... no need to put formulas in again...Already there???

  23. #23
    Forum Contributor
    Join Date
    10-31-2018
    Location
    venezia
    MS-Off Ver
    2007
    Posts
    487

    Re: delete row

    Sorry sintek.
    Your macro works fine
    I am testing your macro in another workbook which after deleting the row and re-entering the formulas in this workbook other values are inserted and it shouldn't.
    The only way for this not to happen is to modify the "put back formula" macro for only the deleted row
    I tried to edit the macro, this is only for row 2602

    Please Login or Register  to view this content.
    Attached Files Attached Files

  24. #24
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,256

    Re: delete row

    I am testing your macro in another workbook which after deleting the row and re-entering the formulas in this workbook other values are inserted and it shouldn't.
    Nope...Don't get it sorry...Perhaps someone else can make sense of what you want to do...

    My code does not delete the formulas?????
    Have no idea what your new requirement is for other workbook...

  25. #25
    Forum Contributor
    Join Date
    10-31-2018
    Location
    venezia
    MS-Off Ver
    2007
    Posts
    487

    Re: delete row

    Thanks the same sintek, post another thread
    A greeting
    john

  26. #26
    Forum Contributor
    Join Date
    10-31-2018
    Location
    venezia
    MS-Off Ver
    2007
    Posts
    487

    Re: delete row

    After some testing I found this

    Application.EnableEvents = False
    Application.EnableEvents = True



    Please Login or Register  to view this content.
    now works.
    Thanks sintek

  27. #27
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,256

    Re: delete row

    Gee...Glad you finally got it sorted...
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.
    Last edited by sintek; 01-31-2021 at 01:18 PM.

  28. #28
    Forum Contributor
    Join Date
    10-31-2018
    Location
    venezia
    MS-Off Ver
    2007
    Posts
    487

    Re: delete row

    Hi,
    I added a sheet "ordina_mail" to the workbook and request a change.
    if the same row deleted with the macro is also present in the sheet "ordina_mail" delete this too
    thnak you
    john
    Attached Files Attached Files

  29. #29
    Forum Contributor
    Join Date
    10-31-2018
    Location
    venezia
    MS-Off Ver
    2007
    Posts
    487

    Re: delete row

    Hi,
    i managed to add the macro it deletes in the sheet "ordina_mail" the same row on the sheet "articoli"
    Now I don't know how to delete the rows that are left blank in the sheet "ordina_mail"
    Attached Files Attached Files

  30. #30
    Forum Contributor
    Join Date
    10-31-2018
    Location
    venezia
    MS-Off Ver
    2007
    Posts
    487

    Re: delete row

    Hi I added this part to the macro
    Please Login or Register  to view this content.
    after deleting the row in the sheet "ordina_mail" this macro sorts ascending and removes the empty rows.

    There is a problem with this part of the macro

    Please Login or Register  to view this content.
    if the row to be deleted with

    Sheets("inserisci_elimina_articolo").Range("D4").Value

    it is not present in the sheet "ordina_mail "but only in the sheet "articoli"

    gives error here

    X2 = Application.Match(Sheets("inserisci_elimina_articolo").Range("D4").Value, Sheets("ordina_mail").Range("B:B"), 0)
    to solve I added

    On Error Resume Next

    is there another way?
    I hope I have explained
    Thanks you
    john
    Attached Files Attached Files

+ 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. [SOLVED] Adding delete code on userform to delete a row on sheet by selecting item on a listbox
    By darbar76528 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 11-07-2020, 12:50 PM
  2. VBA code to delete the FILTERED range and moving the cell up (dont Delete entire row)
    By mchilapur in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-14-2015, 07:48 AM
  3. Replies: 1
    Last Post: 11-30-2013, 06:37 AM
  4. Macro to delete certain columns and delete rows based on time in another column
    By beepbeep27 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-12-2012, 11:47 AM
  5. Macro to delete sheets and saves remaining file does not properly delete module
    By pherrero in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-21-2005, 08:12 PM
  6. Replies: 0
    Last Post: 06-21-2005, 01:05 PM
  7. [SOLVED] Re: Macro to delete sheets and saves remaining file does not properly delete module
    By pherrero in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-21-2005, 01:05 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