Results 1 to 7 of 7

Select Case Question

Threaded View

  1. #1
    Registered User
    Join Date
    01-08-2009
    Location
    Colorado
    MS-Off Ver
    Excel 2007, 2010 PC, 2011 Mac
    Posts
    41

    Select Case Question

    I have the need to filter out letters put in after a number in a time card spreadsheet. I'm not sure that using a select case is the right approach. I need to allow the user to put in a number and a letter signifying what type of time it is. Each cell equals a date on a calendar. For example if the user puts in 8s then the code will add 8 hours to the total sick time, strip out the s and just leave 8 in the cell. The problem is that I need to deal with all of the other letters/symbols that they can enter. From what I know of VBA which isn't much a Select Case seems to be way to go without using a bunch of nested If statements. Here is what I would like to do but this doesn't work. This is a short example of what I have tried as far as Select Case goes.
    Select Case (CellValue)
    Case (InStr(CellValue,"s"))
    'Deal with s condition
    Case (InStr(CellValue,"v")
    'Deal with v condition
    Case Else
    'Deal with all other cases
    End Select
    I can see a couple of other options but have not been able to find out if they are possible in excel. First an entry filter that would only allow the user to enter specific values would at least limit the letters they could enter. Second being able to strip the letter if there is a letter entered off the CellData entered would make the Select Case much simpler.

    Any ideas or other options?

    Thanks
    Last edited by extrapulp; 01-14-2009 at 12:48 PM. Reason: Solved

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