Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Delete Data from textboxes
Hello
I have created, using Excel VBA a userform allows users to write data into a spefic spreadsheet. However, the form consists of about 30 textboxes. What I would like the form to do is clear all the data from the textboxes once the data has been submitted. Currently the form leaves whatever was last in the textbox. Is there any way this could be down using a for each command. Thanks |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Delete Data from textboxes
If you name the textboxes nicely (textbox1, textbox2, ..., textbox30), you could
use code like: dim iCtr as long for ictr = 1 to 30 me.controls("textbox" & ictr).value = "" next ictr If you didn't name them nicely, but they're the only textboxes on that userform: dim ctrl as Control for each ctrl in me.controls if typeof ctrl is msforms.textbox then ctrl.value = "" end if next ctrl nir020 wrote: Hello I have created, using Excel VBA a userform allows users to write data into a spefic spreadsheet. However, the form consists of about 30 textboxes. What I would like the form to do is clear all the data from the textboxes once the data has been submitted. Currently the form leaves whatever was last in the textbox. Is there any way this could be down using a for each command. Thanks -- Dave Peterson |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Delete Data from textboxes
Sub Macro1() ' ' Macro1 Macro ' Macro recorded 11/26/2007 by Joel ' ' For Each shp In ActiveSheet.Shapes If shp.Type = msoTextBox Then shp.DrawingObject.Caption = "" End If Next shp End Sub "nir020" wrote: Hello I have created, using Excel VBA a userform allows users to write data into a spefic spreadsheet. However, the form consists of about 30 textboxes. What I would like the form to do is clear all the data from the textboxes once the data has been submitted. Currently the form leaves whatever was last in the textbox. Is there any way this could be down using a for each command. Thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Show Results in TextBoxes, ONLY if All TextBoxes have Data in them | Excel Programming | |||
Need help w/ userform with 12 textboxes with data going into colum | Excel Discussion (Misc queries) | |||
Textboxes - restrict double-click and selection.delete | Excel Programming | |||
Combining data in multiple textboxes | Excel Programming | |||
Transferring cell data to textboxes | Excel Programming |