+ Reply to Thread
Results 1 to 4 of 4

VBA Code that Clears contents of specific column in row

  1. #1
    Forum Contributor
    Join Date
    02-07-2016
    Location
    England
    MS-Off Ver
    2019
    Posts
    270

    VBA Code that Clears contents of specific column in row

    Hi Excel Forum!

    I am currently using the following formula to insert a new row and copy the contents down. My first goal was to make it so all the content got cleared which I managed to do, but then to save time I wanted to formulas to be copied down as well but none of the other data in the row! I thought I had it with this code but it seems to copy every bit of data instead of just the formulas. I am going to post the code I am using the columns that the formulas are in and the columns I want cleared and a before and after picture so you can see the end result I am looking for.


    I was wondering if there was a piece of VBA that can clear the content from the following columns but only on the newly insterted row not the whole column if that makes sense.

    The data I want cleared when the the row is added are in columns A to H then also in column J, L and M.

    The formulas are in columns I & K.

    Before and after pictures


    I hope this makes sense! Let me know if you need any further information!

    I hope someone can help
    Last edited by Jamidd1; 03-20-2016 at 07:05 AM.

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: VBA Code that Clears contents of specific column in row

    Please Login or Register  to view this content.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  3. #3
    Forum Contributor
    Join Date
    02-07-2016
    Location
    England
    MS-Off Ver
    2019
    Posts
    270

    Re: VBA Code that Clears contents of specific column in row

    Thank you very much! This is perfect!

    see I did something like this before but it just cleared all of the column! How does this work if you don't mind me asking?

  4. #4
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: VBA Code that Clears contents of specific column in row

    You can see it by starting your macro recorder
    pressing ctrl and selectin A1 to H1, then J1 and then L1 to M1

    release the ctrl key
    and then right click clear contents.

    Stop your recorder
    You have a two line macro
    Line one selecting the cells
    Line two deleting the cells

    The code then needs to be edited, firstly to make it one row and

    then to replace 1" with " & A where A is your row number.

+ 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. Code that extracts cell contents from specific cells
    By TreeLife in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-24-2016, 08:43 AM
  2. vba code to clears cells and hide rows
    By Zimmerman in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-04-2015, 10:09 AM
  3. Navivgation bar that activates selected sheet, then clears contents of the bar
    By jkindustries in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-24-2015, 08:53 AM
  4. [SOLVED] code to clear all contents in columns with specific text in row 2
    By xcelnovice101 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-30-2014, 08:58 AM
  5. code that will delete and clear specific contents in the workbook
    By Khanzaki in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-01-2013, 01:18 PM
  6. Macro that clears contents of all cells of certain colour (colour 35) in all sheets
    By Hanskubansku in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-25-2012, 07:33 AM
  7. Macro clears contents and my formula references
    By moike in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 09-19-2006, 01:04 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