I have a userform with a single combobox (cboReportPeriod) and command button (cmdAdd). The combobox gets its values from a range titled ReportPeriodList on the worksheet titled lookUpList. The range is month and year as text (e.g., January 2012, February 2012). I have another range titled CurrentReportPeriod (=Sheet1!$A$2:$A$1048576) on sheet 1.
I want all cells that have entries in column A to be replaced by the selection made in the combobox. I can open the form, make a selection from the combobox, and clicking the command button appears to be doing "something", but the existing text in column A is still the same. Do I have the wrong syntax for If cell.Value = True?
Private Sub cmdAdd_Click() Dim cbo As ComboBox Dim cell As Range For Each cell In Range("CurrentReportPeriod") If cell.Value = True Then cell.Value = Me.cboReportPeriod.Value End If Next cell Me.cboReportPeriod.Value = "" Unload Me End Sub Private Sub UserForm_Initialize() Dim i As Long Dim ReportPeriodList As Range Dim cbo As ComboBox Dim ws As Worksheet Set ws = Worksheets("lookUpList") For i = 1 To Range("ReportPeriodList").Rows.Count Adjusted the code tagsMe.cboReportPeriod.AddItem Range("ReportPeriodList")(i) Next i End Sub