How to Add a macro in VBA

Closed
shree - Mar 11, 2011 at 03:32 PM
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 - Mar 11, 2011 at 03:49 PM
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 response

rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 766
Mar 11, 2011 at 03:49 PM
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
0