Closed Thread
Results 1 to 4 of 4

Macro to Select Date

  1. #1
    Registered User
    Join Date
    01-17-2010
    Location
    Jakarta
    MS-Off Ver
    Excel 2007
    Posts
    1

    Macro to Select Date

    Hi,

    I have developed a Chart with dynamic variables using the combination of OFFSET and MATCH functions to select the data from a table based on dates. I have given below all the formulas and names defined in the workbook.

    ChartDates=Chart!$A$26:$A$1048576
    EndDate=Chart!$H$22
    StartDate =Chart!$E$22


    Chart Price (primary) Series is Defined as
    XValuesPrice =OFFSET(Chart!$A$26,MATCH(Chart!StartDate,Chart!ChartDates,1)-1,0,MATCH(Chart!EndDate,Chart!ChartDates,1)-MATCH(Chart!StartDate,Chart!ChartDates,1)+1,1)
    YValuesPrice =OFFSET(Chart!XValuesClose,0,1)

    Chart Volume (secondary) Series is Defined as
    XValuesVolume =OFFSET(Chart!$A$26,MATCH(Chart!StartDate,Chart!ChartDates,1)-1,0,MATCH(Chart!EndDate,Chart!ChartDates,1)-MATCH(Chart!StartDate,Chart!ChartDates,1)+2,1)
    YValuesVolume =OFFSET(Chart!XValuesVolume,0,2)

    There are two lines in the chart one for Price and other for volume.

    EndDate and StartDate are dynamic and selected from a data validation list (combo box) for the range I want the graph to be generated.

    Now I want to insert a button to predefine the date range for “6 Month”, “3 months”, etc. e.g. if I press the 6 month button the macro should select the right “StartDate” to generate the chart for the 6 month period automatically (if the exact date to define the 6 month period is not available in the data range the macro should select the closest date to 6 month). “Enddate” will remain as current date or the latest date for which data is available.

    I am not familiar with VBA coding , I would greatly appreciate if someone can help me with the coding to do the above task.

    Regards,

    Irshad

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Macro to Select Date

    Welcome to the Board, however, note:

    Your post does not comply with Rule 8 of our Forum RULES. Cross-posting is when you post the same question in other forums on the web. You'll find people are disinclined to respond to cross-posts because they may be wasting their time solving a problem that has been solved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser)to the cross-post. Expect cross-posts without a link to be closed a message will be posted by the moderator explaining why. We are here to help so help us help you!

  3. #3
    Forum Contributor marc5354's Avatar
    Join Date
    11-10-2009
    Location
    India
    MS-Off Ver
    Excel 2003 & Excel 2007
    Posts
    217

    Date Validation to get perfect TAT

    Hi,

    I have the data in the excel sheet, please find the attached file Time Management.



    I guess it can be done with the help of Conditional format or by IF Function or by the VB but am not sure how to do..

    Please suggest if you have a solution. I am really very Sad...

    Thanks to all for the help.

    Thank you...
    ...Marc Simpson
    Attached Files Attached Files

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Macro to Select Date

    marc5354,

    Your post does not comply with Rule 2 of our Forum RULES.

    Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread.

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1