Finding all dates in a cell that are between two given dates, and assign a string to it

qarbiq

New Member
Joined
Jan 4, 2014
Messages
20
Ok I really need help with the following issue that I have</SPAN>
I have a sheet called DATA which contains lists of data , like name, title, dates, etc… , ROW C contains lists of dates</SPAN>

My User Interface asks users to select two dates</SPAN>
Date 1, and Date 2 , and then hit submit button ( I already have these done which works fine )</SPAN>


Now what doesn’t work :</SPAN>
the submit button needs to go look at the date 1 and date 2 (which are being populated inside textbox after user select the date) and compare to ROW C in the DATA sheet and if it find anything in between the dates use those dates to Populate GRAPH</SPAN>

I already have the graph VBA code , all I need is the code to compare the dates and find all matching dates in the ROW C, and whatever it find there sign it to a string and pass it to the graph… so here is portion of code , please let me know how to fix this. THANK YOU</SPAN>


Code:
Private Sub btn_Graph_Click()</SPAN>
D1 = CDate(txtDate1.Value)</SPAN>
D2 = CDate(txtDate2.Value)</SPAN>
  If D1 > D2 Then</SPAN>
MsgBox ("Date 1 Should be Smaller than Date 2 , Please fix")</SPAN>
Exit Sub</SPAN>
Else</SPAN>
End If</SPAN>
If D1 = D2 Then</SPAN>
MsgBox ("Date 1 Can't be Equal Date 2 , Please fix")</SPAN>
Exit Sub</SPAN>
Else</SPAN>
GoTo 99</SPAN>
End If</SPAN>
99  </SPAN>
 
‘ HERE IS THE SECTION I HAVE NO IDEA HOW TO DO</SPAN>
If ActiveCell.Value > D1 And ActiveCell.Value < D2 Then</SPAN>
‘ HERE IS THE SECTION I HAVE NO IDEA HOW TO DO</SPAN>
xRequestorECD = "='Data'!$C$2:$C$13"</SPAN>
 xAssigneeECD = "='Data'!$J$2:$J$13"</SPAN>
 xCompleted = "='Data'!$P$2:$P$13"</SPAN>
 
    ActiveSheet.Shapes.AddChart.Select</SPAN>
    ActiveChart.ChartType = xlXYScatterSmooth</SPAN>
    ActiveChart.SeriesCollection.NewSeries</SPAN>
    ActiveChart.SeriesCollection(1).Name = "Requestor ECD"</SPAN>
  '  ActiveChart.SeriesCollection.(1)XValues = xRow</SPAN>
  ‘  ActiveChart.SeriesCollection(1).Values = rrty</SPAN>
    ActiveChart.SeriesCollection.NewSeries</SPAN>
    ActiveChart.SeriesCollection(2).Name = "Assignee ECD"</SPAN>
  '  ActiveChart.SeriesCollection(2).XValues = "='Data'!$Q$2:$Q$9" ' & xRow</SPAN>
    ActiveChart.SeriesCollection(2).Values = xAssigneeECD</SPAN>
    ActiveChart.SeriesCollection.NewSeries</SPAN>
    ActiveChart.SeriesCollection(3).Name = "Completed"</SPAN>
    ActiveChart.SeriesCollection(3).Values = xCompleted</SPAN>
 
‘ so if I can assign a string to found data a a range then I can pass it to my graph , if you know what I mean.</SPAN>
 
Is there anyone out there to help me ? I am new to this VBA thing and I know it should be easy but I can’t figure it out</SPAN>
 
   
    With ActiveChart.Parent</SPAN>
        .Height = 225 ' resize</SPAN>
        .Width = 400 ' resize</SPAN>
        .Top = 108 ' reposition</SPAN>
        .Left = 50 ' reposition</SPAN>
 
    End With</SPAN>
   
    Exit Sub</SPAN>
 
End If</SPAN>
 
End Sub</SPAN>
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.

Forum statistics

Threads
1,223,246
Messages
6,170,996
Members
452,373
Latest member
TimReeks

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top