gheyman
Well-known Member
- Joined
- Nov 14, 2005
- Messages
- 2,342
- Office Version
- 365
- Platform
- Windows
I would like to add an If statement to the code below so that if column B does not have only one "X" in it the user gets a MsgBox
If there are 0 "X" = MsgBox "You must select one Proposal"
if there are more than one "X" then MsgBox "You can only select one Proposal. It appears that you have more then one selected"
Thank you for the help!
If there are 0 "X" = MsgBox "You must select one Proposal"
if there are more than one "X" then MsgBox "You can only select one Proposal. It appears that you have more then one selected"
Thank you for the help!
Code:
Sub ProposalName()
Dim lrow2 As Long, i As Long, iRow2
lrow2 = Worksheets("Step 1").Cells(Rows.Count, "B").End(xlUp).Row
iRow2 = 11
For i = 1 To lrow2
If Cells(i, "B") = "X" Then
Worksheets("Products").Range("A3") = "PL-" & Worksheets("Step 1").Cells(i, "C") & ", " & Worksheets("Step 1").Cells(i, "D")
iRow2 = iRow2 + 1
Else
End If
Next i
End Sub