excel - Activate form button subject to some condition -


i using form 2 combo-boxes , button. want button disabled , should enable when user selects valid value in both combo-boxes.

i tried disable button using form initialize sub-routine button appears active. can issue? how enable button using if conditions?

private sub userform1_initialize()      me.shapes("buttonname1").controlformat.enabled = false     activesheet.shapes("buttonname1").font.colorindex = 16  end sub 

you made couple of mistakes in code.

  • userform1_initialize should userform_initialize
  • you can use userform.buttonname1 access properties of button
  • use textframe.characters.font.colorindex access text on button on worksheet


code below should work

private sub userform_initialize()     userform1.buttonname1.enabled = false     activesheet.shapes("buttonname1").textframe.characters.font.colorindex = 16 end sub 

Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -