Databases Reference
In-Depth Information
FIGURE 9.30 Sample data sets in SampleData Worksheet.
Optional ByVal endcol = 0, Optional ByVal header_row As Long = 1)
'Places the specified Headers in Combobox in wksheet in wkbook
'Dim Headers() As String
Dim col As Integer, arrayindex As Integer
Dim thissheet As String
Dim lastEntryCell As Range
'If ending column not specified use Last column in header row
If endcol = 0 Then endcol = LastColinRowX(wkbook, wksheet,
header_row)
'Clear any Pre-Existing Entries
Combo.Clear
'Debug.Print startcol, endcol
'Write All Headers into Array
For col = startcol To endcol
arrayindex = arrayindex + 1
ReDim Preserve Headers(1 To arrayindex)
Headers(arrayindex) =
Workbooks(wkbook).Worksheets(wksheet).Cells(header_row,
col).Value
'Write Headers into Combobox
Combo.AddItem Headers(arrayindex)
Next col
End Sub
This subroutine is only called once, as soon as the Workbook is activated. The code to do this
resides in the Workbook_Activate subroutine.
Private Sub Workbook_Activate()
'Only Execute Once at Startup
If Worksheets("pkaCurveFit").ComboBox_Sample.ListCount < 2 Then
Call
HeadersToCombobox(Worksheets("pkaCurveFit").ComboBox_Sample,
Headers(), ActiveWorkbook.Name, "SampleData", 2)
End If
'Enable Start Button if Disabled
Search WWH ::




Custom Search