+ Reply to Thread
Results 1 to 4 of 4

Clear contents between two header values

  1. #1
    Registered User
    Join Date
    11-13-2012
    Location
    uk
    MS-Off Ver
    Excel 2010
    Posts
    77

    Clear contents between two header values

    I Have a workbook with data starting in row 120. I would like a vba code to clear the contents of cells between two columns titled 'TOTAL' and 'Arrears' starting from row 121. The 'TOTAL' column is always on column G but 'Arrears can fall any where from H to AD. Data can run to around 300 rows.I have attached a spreadsheet to illustrate.

    Thank you!

    p.s.
    yesterday I posted a similar problem but I wanted the columns be deleted and ben8563 kindly provided the below solution. I now would like the option of clearing contents instead of deleting columns and I don't know how to change this code.

    Sub test()
    end_1 = Rows(120).Find("Arrears")(1, 0).Address
    Range("H120:" & end_1).EntireColumn.Delete Shift:=xlToLeft
    End Sub
    Attached Files Attached Files
    Last edited by hoss88; 02-16-2022 at 05:47 AM.

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Clear contents between two header values

    Range("H120:" & end_1).EntireColumn.ClearContents

  3. #3
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,710

    Re: Clear contents between two header values

    Try this code
    Please Login or Register  to view this content.
    Pl note
    Array formula should be confirmed with Ctrl+Shift+Enter keys together.
    If answere is satisfactory press * to add reputation.

  4. #4
    Registered User
    Join Date
    11-13-2012
    Location
    uk
    MS-Off Ver
    Excel 2010
    Posts
    77

    Re: Clear contents between two header values

    great thank you woks perfectly

+ 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] Compare column & row values - clear contents on intersection cell
    By dejadem in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-14-2020, 08:03 AM
  2. VBA to find header and clear contents
    By juriemagic in forum Excel Programming / VBA / Macros
    Replies: 21
    Last Post: 04-05-2019, 06:32 AM
  3. Clear Contents based on values of two columns
    By anthronewman in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-30-2015, 02:05 PM
  4. [SOLVED] Clear Contents Under List of Specified Values
    By dreicer_Jarr in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-29-2013, 11:22 AM
  5. Code to Clear Contents if values is zero
    By chico.corrales in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-19-2013, 08:04 PM
  6. cant clear contents of a cell having negative values
    By subha in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-17-2008, 06:03 AM
  7. [SOLVED] HOW DO I PROTECT VALUES WHEN CREATING CLEAR CONTENTS MACRO?
    By the holster in forum Excel General
    Replies: 1
    Last Post: 02-20-2006, 02:40 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