#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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" wrote in message
.. .
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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 486
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default If...then

That worked good. Thanks

DRD

"Bob Phillips" wrote in message
...
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" wrote in message
.. .
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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 06:40 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"