We help IT Professionals succeed at work.
Get Started

encode month and category in excel vba

PeterBaileyUk
on
420 Views
Last Modified: 2012-08-15
I have a range of cells for a client that represent 12 months with 11 rows each representing a category.

so b16 to m26 represents a whole years worth of monthly data against each category.

I want to do an event on the cell in the range that is clicked and I have setup the code to do that.

as the 11 categories and months stay the same i wonder if there is an easier way to get to my event code without trawling through a long select case:

    Select Case Target.Address
        'jan
        Case "$b$16"
        'event for category overall jan
        Case "$b$17"
        'event for category smmt jan
        Case "$b$18"
        Case "$b$19"
        Case "$b$20"
        Case "$b$21"
        Case "$b$22"
        Case "$b$23"
        Case "$b$24"
        Case "$b$25"
        Case "$b$26"
        
        
        'feb
        Case "$c$16"
         'event for category overall feb
        Case "$c$17"
        
        Case "$c$18"
        Case "$c$19"
        Case "$c$20"
        Case "$c$21"
        Case "$c$22"
        Case "$c$23"
        Case "$c$24"
        Case "$c$25"
        Case "$c$26"

Open in new window

ee.PNG
Comment
Watch Question
Engineer
CERTIFIED EXPERT
Commented:
This problem has been solved!
Unlock 1 Answer and 4 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE