Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Show Results in TextBoxes, ONLY if All TextBoxes have Data in them RyanH Excel Programming 3 November 19th 07 03:30 PM
Need help w/ userform with 12 textboxes with data going into colum cj2k2k Excel Discussion (Misc queries) 1 June 13th 07 02:38 PM
Textboxes - restrict double-click and selection.delete [email protected] Excel Programming 0 May 18th 06 09:07 PM
Combining data in multiple textboxes toocold[_5_] Excel Programming 2 March 29th 06 10:53 PM
Transferring cell data to textboxes Merlin Excel Programming 1 October 5th 05 06:47 PM


All times are GMT +1. The time now is 11:21 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"