How to Add a macro in VBA

[Closed]
Report
-
Posts
4476
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
August 2, 2020
-
Hello, Friends

I want to add some macros to my excel sheet. Suppose Cell "A1" is formatted in validation ( list drop down) which contains Contractor, Rent, Sub- Contractor etc.

I want, Cell "B1" should change accordingly say 94C, 94I, 94J resp.

Say, if I select in cell "A1" "Rent" from the list drop down then "B1" will show 94I automatically.

I am using windows 2003. I am trying this function from very long time. But unable to succeed.

If anyone provide me the help. I will be very thankful.



1 reply

Posts
4476
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
August 2, 2020
768
see this
https://ccm.net/forum/affich-269392-dropdown-lists-in-excel-2007

I believe it works on 2003 too.

It may be beyond what you want but would show you basic idea that you need to use
Private Sub Worksheet_Change(ByVal Target As Range)

End Sub
and how you can use it