+ Reply to Thread
Results 1 to 4 of 4

assistance on vba code to clear specific text on a sheet not workingas it should be

  1. #1
    Forum Contributor
    Join Date
    02-11-2014
    Location
    mauritius
    MS-Off Ver
    MS365
    Posts
    1,079

    assistance on vba code to clear specific text on a sheet not workingas it should be

    I have a workbook where I need to clear several specific text in cells which are scattered in the worksheet from range A1 to M 20000.

    The data comes from an external interface .

    I used the code below , but works only for the first text Aaaaa LTD. the others still appears on the sheet.

    Can anyone assists



    Please Login or Register  to view this content.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,531

    Re: assistance on vba code to clear specific text on a sheet not workingas it should be

    You didn't explain what you are trying to do, and it's not clear from your code what you are trying to accomplish.

    Your code says:

    Take the value in cell c
    Change it to all uppercase
    If you find the string "Aaaaa LTD" in the result, then change that string to null.
    If the resulting string is not the same length as the original (implying that the string was found and changed to null), then clear the entire cell.

    You will never find "Aaaaa LTD" (or any of those other strings) in a string that has been converted to all uppercase.

    If you are looking to clear any cells that exactly match any of those strings, then I would do this:
    Please Login or Register  to view this content.
    If you are looking to clear any cells that contain any of those strings, then I would do this:
    Please Login or Register  to view this content.
    Last edited by 6StringJazzer; 01-20-2018 at 09:57 PM.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,086

    Re: assistance on vba code to clear specific text on a sheet not workingas it should be

    Step through the code and check the used range address range. You're also converting the cell value to upper case so the comparisons may fail.


    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  4. #4
    Forum Contributor
    Join Date
    02-11-2014
    Location
    mauritius
    MS-Off Ver
    MS365
    Posts
    1,079

    Re: assistance on vba code to clear specific text on a sheet not workingas it should be

    Thanks you The second option worked

+ 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] assistance on vba code to delete specific words in a column
    By JEAN1972 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 06-15-2017, 10:08 AM
  2. [SOLVED] assistance to adjust code to sum on their specific worksheets in vba
    By JEAN1972 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-05-2017, 04:00 PM
  3. VBA MAcro to clear contents of specific cells if a specific cell contains text
    By muzzareilly in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-28-2017, 12:47 PM
  4. [SOLVED] Vba assistance to copy specific row with criteria to another sheet
    By sintek in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-08-2016, 06:21 AM
  5. [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
  6. 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
  7. Assistance with Creating a Specific Macro using VBA code
    By Pbeer in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-17-2008, 05:35 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