VBA Conundrum

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
 
Last edited:

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.

Forum statistics

Threads
1,216,057
Messages
6,128,527
Members
449,456
Latest member
SammMcCandless

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top