ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Easy Question (https://www.excelbanter.com/excel-programming/280077-easy-question.html)

Lawson

Easy Question
 
i need a program to run only if a value is met in a
certain cell...is that what this is all about?...or
something like this anyway...--

Private Sub Worksheet_SelectionChange(ByVal Target As
Range)

End Sub

steve

Easy Question
 
Lawson,

Depends on when you want the program (macro?) to run:
on selection (Target = cell selected)
on cell change (Target = cell changed)
on calculation (no Target)
each has an event

just need
If Range(A1) = *value* then
Call MyMacro
End If

change A1 to your cell, set *value* to a varaiable, a reference, or a value.
Target can sometimes be used for Range(A1) if they are the same.

--
sb
"Lawson" wrote in message
...
i need a program to run only if a value is met in a
certain cell...is that what this is all about?...or
something like this anyway...--

Private Sub Worksheet_SelectionChange(ByVal Target As
Range)

End Sub





All times are GMT +1. The time now is 09:40 AM.

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