Excel vba:如果“列表框”选择的值= 2,则显示textbox4,否则隐藏文本框

时间:2018-07-18 15:59:18

标签: excel-vba if-statement listbox

我有一个列表框,其中包含来自名为(function() { var myLayers = getAll(), emptyGroups = ""; for (var i = 0; i < myLayers.length; i++) { myLayers[i].isEmpty && emptyGroups += "name: " + myLayers[i].name + "; index: " + myLayers[i].index + "\n"; } alert(emptyGroups == "" ? "No empty groups found" : emptyGroups); function getAll() { var lyrs = [], prevType = -1, thisType = -1; try { activeDocument.backgroundLayer; var layers = 0 } catch (e) { var layers = 1; }; while (true) { ref = new ActionReference(); ref.putIndex(charIDToTypeID('Lyr '), layers); try { var desc = executeActionGet(ref); } catch (err) { break; } thisType = desc.getInteger(stringIDToTypeID("layerKind")); var lyr = { name: desc.getString(charIDToTypeID("Nm ")), index: layers, type: thisType, //7 is start of the group. 13 is end of the group isEmpty: (thisType == 7 && prevType == 13) ? true : false, }; prevType = thisType lyrs.push(lyr) layers++; } return lyrs } })() 的工作表中的值。值是:

  1. 单分裂
  2. 多次拆分
  3. 城市多元

我想要一个“ MultiSplit”(文本框),该文本框在列表框中选择值Database OUtypes时显示,而在选择其他值时隐藏。

我该怎么做?

2

1 个答案:

答案 0 :(得分:0)

找到了

Private Sub OUtypes_Change()
If OUtypes = "Multi Split" Then
Label18.Visible = True
Multisplit.Visible = True
Else
Label18.Visible = False
Multisplit.Visible = False
End If
End Sub

编辑:通过使用布尔值,可以将其合并为更清晰的文字:

Private Sub OUtypes_Change()

    visible = (OUtypes = "Multi Split") ' Boolean expression
    Label18.Visible = visible
    Multisplit.Visible = visible

End Sub