![]() |
Excel VBA - Userform Checkbox/Textbox Problem
I'm creating a Userform which includes manufacture dates and shelf
life. I have a Checkbox and a Textbox that I would like to have work together. I would like the Checkbox unchecked on startup and the associated Textbox to be disabled unless the Checkbox is checked. The code currently reads: Private Sub chkExtension_Change() If chkExtension = True Then ActiveCell.Offset(0, 15).Value = "Yes" Else ActiveCell.Offset(0, 15).Value = "NO" End If If chkExtension = True Then txtExtDate.Enabled = True Else chkExtension.Enabled = False txtExtDate.Enabled = False End If End Sub --- Message posted from http://www.ExcelForum.com/ |
Excel VBA - Userform Checkbox/Textbox Problem
Thunder,
Try this Private Sub chkExtension_Click() If chkExtension.Value = True Then txtExtDate.Enabled = True Else txtExtDate.Enabled = False End If End Sub Private Sub UserForm_Activate() txtExtDate.Enabled = False End Sub -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Thunder5 " wrote in message ... I'm creating a Userform which includes manufacture dates and shelf life. I have a Checkbox and a Textbox that I would like to have work together. I would like the Checkbox unchecked on startup and the associated Textbox to be disabled unless the Checkbox is checked. The code currently reads: Private Sub chkExtension_Change() If chkExtension = True Then ActiveCell.Offset(0, 15).Value = "Yes" Else ActiveCell.Offset(0, 15).Value = "NO" End If If chkExtension = True Then txtExtDate.Enabled = True Else chkExtension.Enabled = False txtExtDate.Enabled = False End If End Sub --- Message posted from http://www.ExcelForum.com/ |
All times are GMT +1. The time now is 09:41 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com