+ Reply to Thread
Results 1 to 5 of 5

VBA to Delete values/ Formula from a column excluding certain values

  1. #1
    Registered User
    Join Date
    10-25-2012
    Location
    staffordshire, UK
    MS-Off Ver
    Excel 2003 excel 2010
    Posts
    18

    VBA to Delete values/ Formula from a column excluding certain values

    Hi All

    I am a relative novice when it comes to VBA - I probably know enough to be spreadsheet dangerous.

    All I am trying to do is clear the contents of cells in a column - All whole numbers but leave certain text+Numbers in a cell.

    The data is fluid so changes each week - apart from the 1st row.

    So in my example - I do not want to touch column A, In column B I want to delete all numbers but Leave the words Bas1, Bas2 Bas3 Bas4 in the cells they are in.

    I have done a lot of searches and trials but not got what I need - Apologies if this is simple.
    Attached Files Attached Files

  2. #2
    Spammer
    Join Date
    10-23-2012
    Location
    Adelaide, Australia
    MS-Off Ver
    Excel 2003, Office 365
    Posts
    1,237

    Re: VBA to Delete values/ Formula from a column excluding certain values

    Seems like the numbers are generated by formulas? Try this macro;
    Please Login or Register  to view this content.
    or...
    Please Login or Register  to view this content.
    Last edited by Croweater; 02-18-2022 at 10:44 PM.

  3. #3
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Cool Hi ! Try this !


    According to the attachment a VBA demonstration according to Excel basics for starters :

    PHP Code: 
    Sub Demo1()
        
    With ActiveSheet.UsedRange.Columns(2)
            .
    Value2 Evaluate(Replace("IF(ISTEXT(#),#,"""")""#", .Address))
        
    End With
    End Sub 
    ► Do you like it ? ► So thanks to click on bottom left star icon « Add Reputation » !

  4. #4
    Registered User
    Join Date
    10-25-2012
    Location
    staffordshire, UK
    MS-Off Ver
    Excel 2003 excel 2010
    Posts
    18

    Re: VBA to Delete values/ Formula from a column excluding certain values

    Quote Originally Posted by Croweater View Post
    Seems like the numbers are generated by formulas? Try this macro;
    Please Login or Register  to view this content.
    or...
    Please Login or Register  to view this content.
    Thanks Croweater - Both work spot on.

  5. #5
    Registered User
    Join Date
    10-25-2012
    Location
    staffordshire, UK
    MS-Off Ver
    Excel 2003 excel 2010
    Posts
    18

    Re: Hi ! Try this !

    Quote Originally Posted by Marc L View Post

    According to the attachment a VBA demonstration according to Excel basics for starters :

    PHP Code: 
    Sub Demo1()
        
    With ActiveSheet.UsedRange.Columns(2)
            .
    Value2 Evaluate(Replace("IF(ISTEXT(#),#,"""")""#", .Address))
        
    End With
    End Sub 
    ► Do you like it ? ► So thanks to click on bottom left star icon « Add Reputation » !
    Cheers Marc L - Works as well - Thank you

+ 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. Find last X values from column J excluding blanks, return value from column A
    By bfmhoops16 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 01-24-2022, 11:39 AM
  2. [SOLVED] Extract Values in a Column Excluding Blanks
    By bjnockle in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-10-2020, 01:32 PM
  3. Averageif not excluding 0 values in column
    By rach2017 in forum Excel General
    Replies: 3
    Last Post: 03-13-2017, 10:37 PM
  4. [SOLVED] Excluding values in MIN / MAX formula
    By MikeyIGN in forum Excel General
    Replies: 7
    Last Post: 04-17-2016, 04:19 PM
  5. Replies: 1
    Last Post: 03-03-2014, 11:06 AM
  6. [SOLVED] Linking to a column of values, excluding duplicates?
    By bauerbach in forum Excel General
    Replies: 5
    Last Post: 06-25-2012, 02:13 PM
  7. [SOLVED] Organizing array into column excluding non zero values
    By Kybynn in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-28-2012, 10:17 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