+ Reply to Thread
Results 1 to 3 of 3

Complicated Clear Contents Loop with Numbering Function

  1. #1
    Registered User
    Join Date
    02-17-2020
    Location
    Houston, Texas
    MS-Off Ver
    365
    Posts
    2

    Complicated Clear Contents Loop with Numbering Function

    I have a spreadsheet that requires a significant amount of reformatting every two weeks enabling utilization in another program for billing purposes. The ultimate output are invoices. I have two objectives:

    The first is to clear contents of cells with duplicate unique identifiers. Column F in the attached sample spreadsheet is the unique identifier. For each subsequent row containing the same identifier, contents of cells in columns A through S are cleared. For example, If F4 = F3, then clearcontents of A4:S4. The following code was successful for the first; however, I have been unable to loop this for the entire worksheet. The master every two weeks is roughly 16,000 lines.

    Please Login or Register  to view this content.
    Upon execution of this macro, for each identifier, Column AA requires a renumber from 1 to 100, depending on how many lines exist for that particular identifier. For sample, in the sample attached, the above macro would clear the contents of A4 through S9. Subsequently, AA3 would hold "1", AA3 would hold "2", and so forth until the next unique identifier, which then begins the renumbering process.
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Complicated Clear Contents Loop with Numbering Function

    Do you want to Clear the duplicate rows (columns A:S) and leave the blank cells or do you want to delete the duplicate rows entirely?

    If Clear, I assume you want to clear AA as well and then renumber the remaining Identifier rows?

    Before and after worksheets would have been ideal.


    Try this...

    Please Login or Register  to view this content.
    Last edited by AlphaFrog; 02-17-2020 at 10:11 PM.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Registered User
    Join Date
    02-17-2020
    Location
    Houston, Texas
    MS-Off Ver
    365
    Posts
    2

    Re: Complicated Clear Contents Loop with Numbering Function

    Hi Alpha,

    I didn't consider uploading before and after sheets, but duly noted for future posts. This worked perfectly and is probably the most complicated one I have had land in my lap. I spent a couple of days on this one trying to figure out how to loop the clearcontents piece.

    Column AA requires a number on each line. As an example, Lines 4 through 25 would be numbered 2 through 23. I believe I can adjust accordingly. Your help is very much appreciated!!!

+ 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] Need to modify code to loop through these sheets and clear contents
    By g1terra in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-31-2019, 01:18 AM
  2. [SOLVED] loop through each nth row and clear contents
    By ANDREAAS in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-06-2019, 12:59 PM
  3. [SOLVED] Loop through Column, clear contents of the row, where criteria is met
    By ABSTRAKTUS in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-26-2018, 03:29 AM
  4. Trying to create a For loop to clear contents from a number of textboxs
    By forrestgump1980 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-03-2015, 06:52 AM
  5. Loop to clear contents if less than todays date
    By crazdandconfusd in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-01-2014, 02:06 PM
  6. Clear Contents Function
    By mem_dawg in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-20-2011, 05:57 PM
  7. Question regarding clear contents function
    By lilsnoop in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-08-2008, 11:23 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