+ Reply to Thread
Results 1 to 4 of 4

Delete first two characters "=+" from each cell in column A.What is wrong with my code?

  1. #1
    Registered User
    Join Date
    09-26-2015
    Location
    london
    MS-Off Ver
    10
    Posts
    14

    Delete first two characters "=+" from each cell in column A.What is wrong with my code?

    Hello,
    I'm trying to delete first 2 characters from each cell in column A if those 2 characters are =+
    Example
    =+SUM
    SUM
    =+TEST
    STRING

    output in column A should be:
    SUM
    SUM
    TEST
    STRING

    Thank you.



    Sub Delete_characters()
    Dim c As Range
    Application.ScreenUpdating = False
    For Each c In Range("A1", Range("A" & Rows.Count).End(xlUp))

    If Left(c, 2) = "=+" Then c = Right(c, Len(c) - 2)

    Next c
    Application.ScreenUpdating = True
    End Sub

  2. #2
    Forum Contributor
    Join Date
    08-14-2012
    Location
    USA
    MS-Off Ver
    Excel 2007, MS 365 (Windows 10 Pro 64-bit)
    Posts
    810

    Re: Delete first two characters "=+" from each cell in column A.What is wrong with my code

    Hi,
    I use Macro Recording:

    Please Login or Register  to view this content.
    Regards,
    tt3

  3. #3
    Registered User
    Join Date
    09-26-2015
    Location
    london
    MS-Off Ver
    10
    Posts
    14

    Re: Delete first two characters "=+" from each cell in column A.What is wrong with my code

    Thank you, but your code will replace =+ string anywhere in entire sheet and not only in column A. Also this code will delete those 2 characters no matter if they are at the beginning of the cells or not.

  4. #4
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Delete first two characters "=+" from each cell in column A.What is wrong with my code

    Please Login or Register  to view this content.
    If you are happy with my response please click the * in the lower left of my post.

+ 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] Code Clean-Up: Delete "False" worksheet created when "Cancel" is chosen in Input Box
    By Kenny Blackwell in forum Excel Programming / VBA / Macros
    Replies: 25
    Last Post: 08-31-2015, 10:00 AM
  2. [SOLVED] Code that copies row of data to another sheet based on text "Complete"/"Delete"
    By Dremzy in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 04-20-2014, 05:51 PM
  3. Replies: 2
    Last Post: 04-20-2014, 11:18 AM
  4. solution for the blank cell using the IF function
    By ragnaedge in forum Excel General
    Replies: 4
    Last Post: 08-23-2013, 11:03 AM
  5. [SOLVED] If there is any text in column "A$" on "sheet1" then move cell to column "A$" on "sheet2"
    By ckgeary in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-27-2013, 08:28 PM
  6. [SOLVED] Delete row if cell in Column N equal "Different" or Column P equals "Blank"
    By Cyberpawz in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-17-2012, 08:25 AM
  7. VBA Code for deleting rows where cell in column a states "delete row"
    By tnfire in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-20-2009, 06:17 PM

Tags for this Thread

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