Marc Wylie
New Member
- Joined
- Jun 26, 2015
- Messages
- 36
Hi All,
I am trying to write a VBA program which activates on a change within a cell which is a drop down list.
I want the program to identify the text in the cell (D2) and based on the text content and the value in another cell (A2) insert a value into cell E2.
I have tried Select Case and If Then but I am getting nowhere.
At the moment this is what I have:
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = Range("D2") Then
If Range("D2").Value = "Cat I(a)" And Range("A2").Value = "1" Then Range("E2").Select
ActiveCell.FormulaR1C1 = "1"
End If
End Sub
I am wasting hours getting nowhere, and need to expand this program multiple times for different variables and then into different cell ranges but I am stuck right at the starting block.
I am a VBA newbie, and I guess I am going in pretty hard but its a tool I am producing for my MSc Dissertation so I just need to get my head round it and get on.
Many thanks for your time.
Marc
I am trying to write a VBA program which activates on a change within a cell which is a drop down list.
I want the program to identify the text in the cell (D2) and based on the text content and the value in another cell (A2) insert a value into cell E2.
I have tried Select Case and If Then but I am getting nowhere.
At the moment this is what I have:
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = Range("D2") Then
If Range("D2").Value = "Cat I(a)" And Range("A2").Value = "1" Then Range("E2").Select
ActiveCell.FormulaR1C1 = "1"
End If
End Sub
I am wasting hours getting nowhere, and need to expand this program multiple times for different variables and then into different cell ranges but I am stuck right at the starting block.
I am a VBA newbie, and I guess I am going in pretty hard but its a tool I am producing for my MSc Dissertation so I just need to get my head round it and get on.
Many thanks for your time.
Marc
Last edited: