Running a macro based on a cells value
I have a cell that contains a drop down list. I want the macro to run if the
list selection changes. For example: I currently selected 60/40 from the
list. If I select 60/40 again, there is obviously no need to re run the
macro. however, if I change the selection to 80/20 I would want to macro to
run.
Clear? Thanks
Dim model As String
Range("k34").Select
model = ActiveCell.Value
Select Case model
Case ""
Exit Sub
Case "60/40"
Sheets("Model Allocation Inputs").Select
Range("D25:D37").Select
Selection.Copy
Sheets("60-40 Charts").Select
Range("F39").Select
ActiveSheet.Paste Link:=True
Case "80/20"
Sheets("Model Allocation Inputs").Select
Range("e25:e37").Select
Selection.Copy
Sheets("60-40 Charts").Select
Range("F39").Select
ActiveSheet.Paste Link:=True
End Select
End Sub
"Macgru" wrote:
U¿ytkownik "Piwo" napisa³ w wiadomo¶ci
...
I have a macro that I want to run when a cells value changes due to a
selection from a list. How can I make this happen? Thanks in advance.
try to modify this one
i assumed that you cell is A2
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target
As Range)
If Target.Address = "$A$2" Then
Application.Run ...' your macro
End If
End Sub
mcg
|