+ Reply to Thread
Results 1 to 4 of 4

If...then

  1. #1
    David R. Duggan
    Guest

    If...then

    I want to use the value in a named range to determine the action to take
    when clicking on a command button.

    The spreadsheet has range called "Location" based on a the location (city)
    of the sales rep. When clicking on a command button, how can the button
    direct the individual based on this value?

    Something like:??

    If Range("Location").Value = "Loc1" then
    do this
    Else
    do this
    End If

    DRD



  2. #2
    Bob Phillips
    Guest

    Re: If...then

    I would use Select Case

    Select Case Range("Location").Value
    Case "Loc1"
    'do loc1
    Case "Loc2"
    'do loc2
    Case Else
    'do else
    End Select

    --

    HTH

    Bob Phillips

    (remove nothere from the email address if mailing direct)

    "David R. Duggan" <[email protected]> wrote in message
    news:ZwQGf.4820$J%[email protected]...
    > I want to use the value in a named range to determine the action to take
    > when clicking on a command button.
    >
    > The spreadsheet has range called "Location" based on a the location (city)
    > of the sales rep. When clicking on a command button, how can the button
    > direct the individual based on this value?
    >
    > Something like:??
    >
    > If Range("Location").Value = "Loc1" then
    > do this
    > Else
    > do this
    > End If
    >
    > DRD
    >
    >




  3. #3
    Jim Thomlinson
    Guest

    RE: If...then

    Probably better off with a select case statement something like this...

    select case range("Location").value
    case "Here"
    sheets("Here").select
    Range("A1").select
    case "There"
    sheets("There").select
    Range("C10").select
    case "EveryWhere"
    sheets("EveryWhere").select
    Range("D15").select
    case else
    msgbox "No such place"
    End Select

    --
    HTH...

    Jim Thomlinson


    "David R. Duggan" wrote:

    > I want to use the value in a named range to determine the action to take
    > when clicking on a command button.
    >
    > The spreadsheet has range called "Location" based on a the location (city)
    > of the sales rep. When clicking on a command button, how can the button
    > direct the individual based on this value?
    >
    > Something like:??
    >
    > If Range("Location").Value = "Loc1" then
    > do this
    > Else
    > do this
    > End If
    >
    > DRD
    >
    >
    >


  4. #4
    David R. Duggan
    Guest

    Re: If...then

    That worked good. Thanks

    DRD

    "Bob Phillips" <[email protected]> wrote in message
    news:[email protected]...
    >I would use Select Case
    >
    > Select Case Range("Location").Value
    > Case "Loc1"
    > 'do loc1
    > Case "Loc2"
    > 'do loc2
    > Case Else
    > 'do else
    > End Select
    >
    > --
    >
    > HTH
    >
    > Bob Phillips
    >
    > (remove nothere from the email address if mailing direct)
    >
    > "David R. Duggan" <[email protected]> wrote in message
    > news:ZwQGf.4820$J%[email protected]...
    >> I want to use the value in a named range to determine the action to take
    >> when clicking on a command button.
    >>
    >> The spreadsheet has range called "Location" based on a the location
    >> (city)
    >> of the sales rep. When clicking on a command button, how can the button
    >> direct the individual based on this value?
    >>
    >> Something like:??
    >>
    >> If Range("Location").Value = "Loc1" then
    >> do this
    >> Else
    >> do this
    >> End If
    >>
    >> DRD
    >>
    >>

    >
    >




+ 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