+ Reply to Thread
Results 1 to 5 of 5

Change Macro to stop deleting cells in 2 columns

  1. #1
    Registered User
    Join Date
    10-14-2018
    Location
    Brampton, ontario
    MS-Off Ver
    2007
    Posts
    74

    Change Macro to stop deleting cells in 2 columns

    I have been using a macro for awhile and it works except I‘m need help a small change to what cells get deleted in only one specific column. If someone could kindly assist.
    Using the sample Excel sheet image I uploaded, my macro currently deletes cells in the following columns B,C and D. For only the cell range A20:A34 I would like the macro to only delete cells in the B column. The rest of the marco is perfect as it is.
    That’s it. hanks in advance for your help.

    Please Login or Register  to view this content.
    NEW EXCEL SHEET.JPEG

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,962

    Re: Change Macro to stop deleting cells in 2 columns

    Try replacing

    Please Login or Register  to view this content.
    with

    '---- This clears the B/EFG/IJK columns after using the value ----

    Please Login or Register  to view this content.
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Registered User
    Join Date
    10-14-2018
    Location
    Brampton, ontario
    MS-Off Ver
    2007
    Posts
    74

    Re: Change Macro to stop deleting cells in 2 columns

    Hii Bernie

    Just tried the change and columns EFG and IJK get deleted correctly but not the B column. It deletes B/C/D. I only need the B deleted. I tried and tried it's driving me crazy, not sure what's wrong?

    Thanks so much for your help.

  4. #4
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,962

    Re: Change Macro to stop deleting cells in 2 columns

    The code that I posted will not clear columns BCD. Here is that some code, basically, to be run on a new blank worksheet. DO NOT run it on your current workbook.


    I have included code to populate the sheet in a way that only cells in row 22 will be cleared. Afer you run the code, you can see that column B is cleared but not C or D.

    If you remove the 7 lines of code from the section under 'code to fill then the code will work on your existing sheet.


    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    10-14-2018
    Location
    Brampton, ontario
    MS-Off Ver
    2007
    Posts
    74

    Re: Change Macro to stop deleting cells in 2 columns

    Hi Bernie

    Sorry for the delay in getting back to you but that did the trick.

    Thanks so much for your help.

+ 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] Stop Worksheet change event from interfering with macro code
    By BeachRock in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-10-2013, 09:11 PM
  2. Macro to change cells reference addres (+35 in rows, +2 in columns)
    By Shishek in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-28-2013, 11:29 AM
  3. Macro to stop deleting data when a certain row is reached
    By Philb1 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-10-2011, 05:43 PM
  4. Macro Adjustment Needed To Stop Deleting Row When Cancelled
    By JimmiOO in forum Excel Programming / VBA / Macros
    Replies: 21
    Last Post: 08-24-2010, 02:41 AM
  5. Stop Macro if blank cells are within certain columns
    By superbob in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 05-07-2010, 08:45 AM
  6. How to stop file open macro prompt after deleting all macros?
    By twor57 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-29-2005, 01:10 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