If Statement Combo Box

radlernyc

Board Regular
Joined
Jun 9, 2005
Messages
69
cb_BdMtgFee.value is a combo box with Yes and No as choices. I want to place an X in a cell if yes is selected. The code below does not work. Thanks for the help


Code:
If cb_BdMtgFee.value = "Yes" Then

    ws.Range("AW" & LastRow) = "X"
    
Else

    ws.Range("AW" & LastRow) = ""

End If
 

Some videos you may like

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,047
Office Version
  1. 365
Platform
  1. Windows
What type of combobox is it?
 

radlernyc

Board Regular
Joined
Jun 9, 2005
Messages
69
The comb box is in a vb userform. Its rowsource is a named range. The two value in the named range are Yes and No
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,047
Office Version
  1. 365
Platform
  1. Windows
And how is the code not 'working'?

Where is the code located?
 

radlernyc

Board Regular
Joined
Jun 9, 2005
Messages
69

ADVERTISEMENT

The code is located in an event. Command OK fills a data sheet with the values from the form. When combo box is "Yes" it should fill a range with an X. It currently is not working, meaning the combo box is yes but the range does not receive an X.

ws.Range("AW" & LastRow) = "X"
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,047
Office Version
  1. 365
Platform
  1. Windows
What event is it in?
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,047
Office Version
  1. 365
Platform
  1. Windows

radlernyc

Board Regular
Joined
Jun 9, 2005
Messages
69
On Click of a Command Button. On click all values are dumped into a sheet. However, I need the some cells to have an X in them, not "Yes". So I need a piece of code that logicall reads something like this:

If combobox is Yes Then

Cell A5 = x

End If


I have tried multiple variations of this logic, but havent gotten right yet. Thanks for the help
 

Watch MrExcel Video

Forum statistics

Threads
1,118,111
Messages
5,570,257
Members
412,313
Latest member
pauloalex
Top