+ Reply to Thread
Results 1 to 2 of 2

Help with Case function on Macro - Beginner

Hybrid View

  1. #1
    Registered User
    Join Date
    09-03-2015
    Location
    Dublin
    MS-Off Ver
    2010
    Posts
    1

    Help with Case function on Macro - Beginner

    Hi,

    I'm having an issue with a Macro I'm trying to run, I'm still new to this and learning but I've been pulling my hair out for a few hours now and getting nowhere so thought I'd check and see if anyone could help.

    I'm running the macro below on a spreadsheet:

    Private Sub Worksheet_Change(ByVal Target As Range)

    If Target.Cells.Count > 1 Then Exit Sub

    If Not Intersect(Target, Range("C4:C97")) Is Nothing Then
    Select Case UCase(Target)
    Case Is = "N"
    Target.EntireRow.Hidden = True
    Case Is = "Y"
    Target.EntireRow.Hidden = False
    End Select
    End If

    End Sub


    As you can see it's fairly straightforward, if a cell value is "N" then the row is hidden, if it's Y it's not.

    The problem i'm having is a can't seem to change the case to a word, i.e. "Client" as opposed to "N" without breaking the function and getting nowhere. I've tried a few different approaches but nothing seems to work. Can anyone advise?

    Thanks,

    Ryan

  2. #2
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: Help with Case function on Macro - Beginner

    I think you need to change to uCase:-
    Select Case UCase(Target)
    Case Is = "CLIENT"
    Not sure why you need code to not do something , as in "Y"

+ 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. Select Case Macro (Function)
    By nguyenak in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-12-2013, 06:03 PM
  2. Macro Beginner!!
    By R1ck in forum Excel General
    Replies: 4
    Last Post: 12-12-2011, 07:46 AM
  3. VBA Function - beginner
    By steve427 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-14-2011, 07:15 PM
  4. macro for beginner
    By sanlen in forum Excel General
    Replies: 2
    Last Post: 06-23-2010, 12:45 AM
  5. Left function in a Select Case Macro
    By kingdt in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-23-2007, 06:47 AM
  6. Beginner help! error no return() or halt() function found on macro sheet
    By steppin16 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-27-2006, 03:10 PM
  7. [SOLVED] Beginner with Excel Here: Need Help with Cell Formatting Function
    By ljh3rdid in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-27-2006, 05:20 PM
  8. [SOLVED] Macro for a beginner
    By Masha in forum Excel General
    Replies: 2
    Last Post: 02-14-2006, 02:45 AM

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