MFish
Board Regular
- Joined
- May 9, 2019
- Messages
- 76
I'm having an issue with VBA Clear Command Button.
I have a textbox named, txtLoc (Location of my depot) and many more textboxes/comboboxes. I also have my clear command button named, cmdClear. I'm just trying to clear the data out of all my userform criteria but this code doesn't work...
Sub cmdClear_Click()
txtLoc.clear
txtName.clear
setfocus.txtLoc
End Sub
But, why does this one work...
Sub cmdClear_Click()
txtLoc.value = ""
txtName.value = ""
setfocus.txtLoc
End Sub
? I am the type to try to understand "Why" this or "Why" that way it must be written... Can someone send me to a link or just quickly explain why?
Also, on another note, can someone tell me how to make a box that shows my code I've written? I see it in other messages. Thanks.
I have a textbox named, txtLoc (Location of my depot) and many more textboxes/comboboxes. I also have my clear command button named, cmdClear. I'm just trying to clear the data out of all my userform criteria but this code doesn't work...
Sub cmdClear_Click()
txtLoc.clear
txtName.clear
setfocus.txtLoc
End Sub
But, why does this one work...
Sub cmdClear_Click()
txtLoc.value = ""
txtName.value = ""
setfocus.txtLoc
End Sub
? I am the type to try to understand "Why" this or "Why" that way it must be written... Can someone send me to a link or just quickly explain why?
Also, on another note, can someone tell me how to make a box that shows my code I've written? I see it in other messages. Thanks.