+ Reply to Thread
Results 1 to 21 of 21

delete row and enter formula

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

    delete row and enter formula

    Hi to all
    This macro
    Please Login or Register  to view this content.
    deletes the row sheet "articoli" inserted in the sheet "nuovo articolo" cell D4.
    after deleting the row the formulas of the deleted row are inserted with this macro

    Call rimetti_formula

    this macro puts the formulas back across the range and is very slow.
    this macro is possible only for the deleted row?
    I hope I have explained
    thank you
    john
    Attached Files Attached Files

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,493

    Re: delete row and enter formula

    You could just clear the contents instead of replacing the formulas again.


    Please Login or Register  to view this content.

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

    Re: delete row and enter formula

    Hi davesexcel your macro work well.
    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
    thank you
    john
    Attached Files Attached Files

  4. #4
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,493

    Re: delete row and enter formula

    You can add this line to your code.

    Please Login or Register  to view this content.

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

    Re: delete row and enter formula

    Thanks you davesexcel.
    A greeting
    john

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

    Re: delete row and enter formula

    Hi,
    I inserted the change to the macro.

    Please Login or Register  to view this content.
    It almost works well

    if D4

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

    is not present in the sheet "ordina_mail"

    Sheets("ordina_mail").Columns(2).Find(fnd).EntireRow.ClearContents

    it gives an error.

    I intered .EntireRow.ClearContents
    Sheets("ordina_mail").Columns(2).Find(fnd).EntireRow.ClearContents
    because the macro was deleting formulas
    and to delete blank rows there is this macro

    Please Login or Register  to view this content.
    I hope I have explained.
    Attached Files Attached Files

  7. #7
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,493

    Re: delete row and enter formula

    There was no formula in your sheet email sheet so I wasn't too concerned about it.
    Try this.
    Please Login or Register  to view this content.

    The one line will help you decide what cells to clear from the found row.
    Once you run it you will see how it works.

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

    Re: delete row and enter formula

    Undefined variable compilation error

    Please Login or Register  to view this content.
    Last edited by AliGW; 02-12-2021 at 08:27 AM.

  9. #9
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,493

    Re: delete row and enter formula

    Yep, you need to dim fRng as range at the top.

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

    Re: delete row and enter formula

    Please Login or Register  to view this content.
    entere row
    .Range("A" & fRng.Row).Range("L1").ClearContents
    not work
    Last edited by john_cash; 02-11-2021 at 03:19 PM.

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

    Re: delete row and enter formula

    Ops

    .Range("A" & fRng.Row).Range("A1:L1").ClearContents

    Please Login or Register  to view this content.

  12. #12
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,493

    Re: delete row and enter formula

    Are you asking a question?

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

    Re: delete row and enter formula

    It's this correct for the whole row?

    .Range("A" & fRng.Row).Range("A1:L1").ClearContents

  14. #14
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,493

    Re: delete row and enter formula

    What happens when you try it?

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

    Re: delete row and enter formula

    Delete entere row

  16. #16
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,493

    Re: delete row and enter formula

    Is that what the code looks like in post 7?

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

    Re: delete row and enter formula

    Hi,
    there are no formulas in the sheet "ordina_mail" and the macro must delete the contents of the whole row

  18. #18
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,493

    Re: delete row and enter formula

    Please Login or Register  to view this content.
    Experiment with the code
    Last edited by davesexcel; 02-12-2021 at 08:02 AM.

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

    Re: delete row and enter formula

    I ask for confirmation if it is correct

  20. #20
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,493

    Re: delete row and enter formula

    If it works like it is supposed to then it would be correct.

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

    Re: delete row and enter formula

    Okay davesexcel
    A greeting
    john

+ 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. VBA delete cell value and enter new value
    By ioncila in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-25-2016, 05:17 AM
  2. [SOLVED] How to delete an ENTER on a cell
    By pccamara in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-21-2016, 07:54 AM
  3. With VBA Enter Ctrl Shift Enter For Array Formula
    By realniceguy5000 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 08-17-2013, 09:02 AM
  4. [SOLVED] How do I enter a formula that will delete a line when a cell = 0?
    By Jen in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-11-2006, 01:25 PM
  5. [SOLVED] Add or Delete row as per enter
    By Tiya in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-22-2005, 02:00 PM
  6. Replies: 2
    Last Post: 10-20-2005, 05:05 PM
  7. Determine if cell was modified by Enter , Paste or Delete
    By Randy in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-30-2005, 12: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