Results 1 to 8 of 8

Macro to Clear accounts starting with an X

Threaded View

  1. #1
    Forum Contributor
    Join Date
    07-12-2018
    Location
    South Africa
    MS-Off Ver
    Office 2021
    Posts
    2,776

    Macro to Clear accounts starting with an X

    I have account numbers in Col A & B

    where the account number starts with an X in Col A and b from row 2 onwards, i would like to clear these using a macro


    I have tried to write code, but get a compile error "Next without for"

    i have attached my sample data


    It would be appreciated if someone could resolve this

     Sub Clear_X_accounts()
    Sheets("Accounts").Select
    Finalrow = Cells("A65536").End(xlUp).Row
    For i = Finalrow To 2 Step -1
    If Cells(i, 1).Value Like "*X*" Then
    Cells(i, 1).EntireRow.Clear
    If Cells(i, 2).Value Like "*X*" Then
    Cells(i, 2).EntireRow.Clear
    
    End If
    Next i
    End Sub
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 6
    Last Post: 04-16-2015, 01:45 PM
  2. Macro to roll up accounts
    By south12 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-26-2014, 07:36 PM
  3. Please help, intricate subtotal for main accounts with many sub accounts!!
    By mitch_bossard in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-24-2013, 05:17 PM
  4. [SOLVED] Starting from particular cell & clear
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-16-2013, 07:01 AM
  5. Replies: 1
    Last Post: 06-21-2013, 04:05 AM
  6. Replies: 3
    Last Post: 01-08-2013, 01:27 PM
  7. VBA with PivotTable Count of Accounts - Want to show Sum of Accounts
    By snake10 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-19-2008, 07:27 AM

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