Hi,

I am trying to use VBA to achieve the following purpose:


   1. a UserForm pops up once I open a workbook, and the value on the
   drop-down list of 2 ComboBoxes on the UserForm will be automatically
   populated. (I have designed the UserForm, open VBE to view it in the
   attached file)
   2. on the UserForm, after I choose "starting year month" and "ending year
   month", and then click "Select Duration" CommandButton, the VBA code will
   select a range on sheet "data" and use the range as the source data to
   create a chart on sheet "data". For example,  if I select "2009 Jan" as
   "starting year month" and "2009 Apr" as "ending year month", 4 rows will be
   selected to be used as data range for the chart, see the area highlight in
   green. (the rudimentary VBA is also in the attached file)

My problem is I don't know how to use the values obtained from ComboBox
drop-down selection to set up the range. In my VBA code, there is a line to
select a fixed range, see below

*Set rngChtData = ActiveSheet.Range("c1:f49")*

If I know how to replace c1 with the address of the cell which contains the
value of "starting year month", and replace f49 with the address of the cell
that's 3 columns to the right of the cell which contains the value of
"ending year month", I will be getting very closer to my goal.

Any help is highly appreciated!

Thanks!
Jerry

-- 
----------------------------------------------------------------------------------
Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links : 
http://twitter.com/exceldailytip
2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
3. Excel tutorials at http://www.excel-macros.blogspot.com
4. Learn VBA Macros at http://www.quickvba.blogspot.com
5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 
To post to this group, send email to excel-macros@googlegroups.com

<><><><><><><><><><><><><><><><><><><><><><>
Like our page on facebook , Just follow below link
http://www.facebook.com/discussexcel

Attachment: ComboBox_chart.xls
Description: MS-Excel spreadsheet

Reply via email to