+ Reply to Thread
Results 1 to 9 of 9

If EntireRow.Delete then RefreshAll

  1. #1
    Registered User
    Join Date
    05-05-2016
    Location
    Melbourne, Australia
    MS-Off Ver
    Office 365
    Posts
    26

    If EntireRow.Delete then RefreshAll

    Hi all,

    I am trying to create a code using 'Worksheet_SelectionChange', that would refresh a workbook if the 'EntireRow.Delete' event is met on a specific worksheet.

    So far i have come up with the below, however it does not work.

    Appreciate you help.

    Please Login or Register  to view this content.

  2. #2
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: If EntireRow.Delete then RefreshAll

    .
    https://analysistabs.com/vba-code/wo.../m/refreshall/

    I believe you must specify which workbook.

  3. #3
    Registered User
    Join Date
    05-05-2016
    Location
    Melbourne, Australia
    MS-Off Ver
    Office 365
    Posts
    26

    Re: If EntireRow.Delete then RefreshAll

    Thanks for you response Logit.

    I have tried specifying the workbook, however it doesn't work either.

  4. #4
    Registered User
    Join Date
    05-05-2016
    Location
    Melbourne, Australia
    MS-Off Ver
    Office 365
    Posts
    26

    Re: If EntireRow.Delete then RefreshAll

    I have tried another approach, however I am still getting a debug everytime I select a cell.

    Code is placed in the "data" worksheet.

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    05-05-2016
    Location
    Melbourne, Australia
    MS-Off Ver
    Office 365
    Posts
    26

    Re: If EntireRow.Delete then RefreshAll

    Anyone, help please?

  6. #6
    Valued Forum Contributor quekbc's Avatar
    Join Date
    01-18-2010
    Location
    Sydney, Australia
    MS-Off Ver
    2010, 2013, 2016
    Posts
    1,149

    Re: If EntireRow.Delete then RefreshAll

    You're using a selection change event, which is triggered everytime you select a cell that is not currently selected (e.g. you're in A1, then you click on A2) - which I don't think its appropriate here. Additionally, the EntireRow.Delete is a method, rather than an event (i.e. you're telling VBA to delete the row, and not asking whether a row has been deleted).

    I could be wrong, but I don't think there is an event that can capture the deletion of the entire row. Perhaps, you can use something else that's similar and that is...
    Please Login or Register  to view this content.
    Utilises the change event - a macro that runs every time you change something (i.e. type in a formula or edit a cell) to the entire row (like deleting a row). It also runs when you ADD a row or key in data unto the entire row simultaneously by CTRL + ENTER - which, hopefully is acceptable for your purpose.

  7. #7
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: If EntireRow.Delete then RefreshAll

    Try putting this in the ThisWorbook module
    Please Login or Register  to view this content.
    If you only want it to apply to one sheet, then put it instead in that sheet's module
    Click *Add Reputation to thank those who helped you. Ask if anything is not clear

  8. #8
    Registered User
    Join Date
    05-05-2016
    Location
    Melbourne, Australia
    MS-Off Ver
    Office 365
    Posts
    26

    Re: If EntireRow.Delete then RefreshAll

    Thank you all that does the trick! Much appreciated.

  9. #9
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: If EntireRow.Delete then RefreshAll

    Glad you got it to work for you.
    Please mark thread as solved (see Thread Tools @ top of thread)

+ 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. iCell.EntireRow.Delete not working. Need code to Delete Entire Row
    By unit285 in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 05-27-2017, 10:48 PM
  2. Workbook_change, entirerow.delete, possible?
    By Fredma in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-06-2014, 03:06 PM
  3. [SOLVED] Entirerow.delete
    By Prexcel in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 01-17-2014, 09:16 PM
  4. CurrentRegion.EntireRow.Delete (+ the next row)
    By BBoydAnchor in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 12-28-2011, 04:16 PM
  5. How to fix cell.entirerow.delete?
    By guy in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-09-2005, 11:06 PM
  6. [SOLVED] EntireRow.Delete
    By Steph in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 01-21-2005, 07:06 PM
  7. EntireRow.Delete Not what I want
    By spencermjax in forum Excel General
    Replies: 1
    Last Post: 01-14-2005, 11:40 PM

Tags for this Thread

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