Results 1 to 3 of 3

Left/Right function in VBA, finding a specific starting character

Threaded View

  1. #1
    Registered User
    Join Date
    07-24-2012
    Location
    Los Angeles, CA
    MS-Off Ver
    Excel 2010/Excel 2011
    Posts
    2

    Left/Right function in VBA, finding a specific starting character

    Hello,

    I have a worksheet in which I would like to go through column B and see if any cells in column B start with a "-" character. If they start with "-" then I would like to remove it from the cell. I've been trying to use the left function in several different ways but nothing has worked for me.

    Examples of what I tried:

    Dim bCell As Range
    Dim cutRange As Range
    
    cutRange = Range("B2:B30000")
    
    For Each bCell in cutRange
    If bCell.Left(1) = "-"
    bCell = bcell.Right(len(bCell)-bCell.Left(1))
    End If
    Next
    This code obviously does not work/compile. Any help is appreciated.

    Thank you.
    Last edited by Cutter; 07-24-2012 at 10:07 AM. Reason: Added code tags

Thread Information

Users Browsing this Thread

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

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