I am working on a userform with a simple set of dates with 5 columns
of data associated with each date. A combobox has been populated with
the column of dates (A4:a19). The user selects a date from the combo
box and a field is populated with the average volume associated with
that date (in this case, column F, a columnoffset of 5). so, the
subroutine takes the user-selected value and interrogates each value
in the range until it finds a match, then collects the associated
value from column F. For some reason, the variable I am using to
increment the row is filling and overflowing. No match is ever found
and I would GREATLY appreciate any comments. I can upload the whole
spreadsheet, if need be. TIA
Private Sub cboWeek_Click()
'======================================
'
'Declare Variables
Dim strWeek As String
Dim rngData As Range
Dim shtWork As Worksheet
Dim introw As Integer
Set shtWork = _
Application.Workbooks("weekly summary.xls").Worksheets("nasdaq")
''Display controls that are hidden
If fraIndex.Visible = False Then
fraIndex.Visible = True
lblVolume.Caption = "Volume:"
lblAvgVol.Visible = True
End If
''Format combobox
cboWeek.Value = Format(cboWeek.Value, "mmm. dd, yyyy")
obtOpen.SetFocus
'Display Average Volume of each Week in the lblAvgVol
Set rngData = _
shtWork.Range("a4").CurrentRegion
strWeek = cboWeek.Value
'locate first occurence of Weekly Date
introw = 2
Do Until rngData.Cells(RowIndex:=introw, columnindex:=1) _
.Value = strWeek
introw = introw + 1
Loop
Do While rngData.Cells(RowIndex:=introw, columnindex:=1) _
.Value = strWeek
lblAvgVol = rngData.Cells(RowIndex:=introw, columnindex:=6).Value
introw = introw + 1
Loop
End Sub