+ Reply to Thread
Results 1 to 3 of 3

IF statement...If InputBox value equals any value within a certain named range...

  1. #1
    Registered User
    Join Date
    05-26-2007
    Posts
    1

    IF statement...If InputBox value equals any value within a certain named range...

    Hey I am trying to make an IF statement as part of a lookup and filter macro for a guest list, and I am trying to get any value within a Named range (Its called ActualGuestSurname)

    How do I make the IF statment compare the input to any value in this named range?

    Thanks
    Here is the macro so far (Line I can't figure out in red, in my own words)

    Sub Macro1()

    Dim intGuestSurname As String
    strGuestSurname = InputBox("Enter Guest Surname")

    If strGuestSurname = NamedRange("ActualGuestSurname") Then

    Application.Goto Reference:="GuestSurname"
    ActiveCell.FormulaR1C1 = strGuestSurname
    Range("GuestDatabase").AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:= _
    Range("Criteria"), Unique:=False

    Else
    MsgBox "That Guest is not on record", vbCritical

    End If


    End Sub

  2. #2
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    Cottie

    Welcome to excelforum

    Please wrap your VBA code - see red lin below for instructions

    To read all forum rules please use blue link below
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

  3. #3
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    I don't know why yoe are using Advanced Filter, AutoFilter should be sufficient

    Please Login or Register  to view this content.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

+ Reply to Thread

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