LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default use ComboBox value to select range and then use selected range tocreate a chart

Hi,

Excel file used in this post:
https://docs.google.com/leaf?id=0B9F...thkey=CIXSoecG


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)

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 file mentioned at the top)

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

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to make chart on selected range? [email protected] Excel Programming 1 October 4th 07 12:42 AM
sheet protection - only selected range to be able to select/input data Corey Excel Worksheet Functions 7 February 13th 07 05:41 PM
Macro to find empty cell and select range to print selected. [email protected] Excel Programming 1 May 15th 06 09:05 AM
Compare a selected Range with a Named range and select cells that do not exist PCLIVE Excel Programming 1 October 18th 05 07:09 PM
Select only visible cells in a selected range DataFreakFromUtah Excel Programming 1 May 13th 04 03:26 AM


All times are GMT +1. The time now is 04:36 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"