CdyMan
10-09-2013, 12:06 PM
In an effort to eliminate 60 some [txbXXX.Value = ""] statements to blank the fields on a userform, I added .Value to each item in a list of controls I already had, then put the for/next in to step through and clear them. Loop is fine, no errors, but the blanking is not happening. Does anyone see the obvious that i'm missing?? I've tried this version with object when a version with ctl as a string and set as a simple assignment didn't work either. Thanks a lot for pointing out the flaw. MsgBox in there just to confirm items coming through--all are what I want.
Private Sub Clear_Click()
Dim wks As Worksheet
Dim idx As Range
Dim ctl As Object
Set wks = Sheets("ControlsList")
For Each idx In wks.Range("ctlsInventory").Rows
Set ctl = idx
'MsgBox ctl
ctl = ""
Next
Private Sub Clear_Click()
Dim wks As Worksheet
Dim idx As Range
Dim ctl As Object
Set wks = Sheets("ControlsList")
For Each idx In wks.Range("ctlsInventory").Rows
Set ctl = idx
'MsgBox ctl
ctl = ""
Next