ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Visual basic code query (https://www.excelbanter.com/excel-programming/393400-visual-basic-code-query.html)

Zakynthos

Visual basic code query
 
Ive coded various items of data and assigned values to each item such that
when I produce a total I want to lookup a particular cell and check for the
total in it and then run a specific program associated with that total.

For example, when the total in, say, cell A50 is 60 I want it to trigger
application A, if 61 then application B etc.

So how would I write a Visual Basic program to: check the value of this cell
containing my total (which may be, for example, between 60 and 120) and then
run the program I have associated with that number?

Many thanks


Stefi

Visual basic code query
 
Try something like this:

Sub test()
Select Case Range("A50").Value
Case 60
Call Application_A
Case 61
Call Application_B
'etc. ...
Case Else
' ...
End Select
End Sub

Regards,
Stefi


€˛Zakynthos€¯ ezt Ć*rta:

Ive coded various items of data and assigned values to each item such that
when I produce a total I want to lookup a particular cell and check for the
total in it and then run a specific program associated with that total.

For example, when the total in, say, cell A50 is 60 I want it to trigger
application A, if 61 then application B etc.

So how would I write a Visual Basic program to: check the value of this cell
containing my total (which may be, for example, between 60 and 120) and then
run the program I have associated with that number?

Many thanks


Zakynthos

Visual basic code query
 
Stefi,

Many thanks for your help.

Best wishes,

Tony

"Zakynthos" wrote:

Ive coded various items of data and assigned values to each item such that
when I produce a total I want to lookup a particular cell and check for the
total in it and then run a specific program associated with that total.

For example, when the total in, say, cell A50 is 60 I want it to trigger
application A, if 61 then application B etc.

So how would I write a Visual Basic program to: check the value of this cell
containing my total (which may be, for example, between 60 and 120) and then
run the program I have associated with that number?

Many thanks


Stefi

Visual basic code query
 
You are welcome! Thanks for the feedback!
Stefi


€˛Zakynthos€¯ ezt Ć*rta:

Stefi,

Many thanks for your help.

Best wishes,

Tony

"Zakynthos" wrote:

Ive coded various items of data and assigned values to each item such that
when I produce a total I want to lookup a particular cell and check for the
total in it and then run a specific program associated with that total.

For example, when the total in, say, cell A50 is 60 I want it to trigger
application A, if 61 then application B etc.

So how would I write a Visual Basic program to: check the value of this cell
containing my total (which may be, for example, between 60 and 120) and then
run the program I have associated with that number?

Many thanks


Don Guillett

Visual basic code query
 
or

Sub test()
Select Case Range("g5").Value
Case Is < 60: Call aaaa
Case 60 To 120: Call bbbb
'etc. ...
Case Else
'...
End Select


End Sub
Sub aaaa()
MsgBox "a"
End Sub
Sub bbbb()
MsgBox "b"
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Stefi" wrote in message
...
Try something like this:

Sub test()
Select Case Range("A50").Value
Case 60
Call Application_A
Case 61
Call Application_B
'etc. ...
Case Else
' ...
End Select
End Sub

Regards,
Stefi


€˛Zakynthos€¯ ezt Ć*rta:

Ive coded various items of data and assigned values to each item such
that
when I produce a total I want to lookup a particular cell and check for
the
total in it and then run a specific program associated with that total.

For example, when the total in, say, cell A50 is 60 I want it to trigger
application A, if 61 then application B etc.

So how would I write a Visual Basic program to: check the value of this
cell
containing my total (which may be, for example, between 60 and 120) and
then
run the program I have associated with that number?

Many thanks




All times are GMT +1. The time now is 12:20 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com