Glaswegian
11-16-2004, 04:48 AM
I have a Textbox on a sheet and I've provided users with a button to clear the text. There is often more than 256 characters in the text and my first macro only clears the textbox if the users click the button until clear. I'm aware that there is a 256 character limit for such things as copying between textboxes, but just wondering if there is a more efficient way to clear a textbox. Here is my first code
Sub clearFileNotes()
ActiveSheet.TextBoxes("Text Box 12").Characters.Text = ""
Range("A1").Select
End Sub
I then tried this but it keeps leaving a few characters - and is probably not very efficient
Sub ClearAllFileNotes()
Dim txtBox As TextBox
Dim x As Integer
Set txtBox = ActiveSheet.TextBoxes("Text Box 12")
For x = 1 To txtBox.Characters.Count
txtBox.Characters(x).Text = ""
Next
End Sub
Just curious if there is a faster/more efficient way to clear the text in one go.
Thanks for your help.
Sub clearFileNotes()
ActiveSheet.TextBoxes("Text Box 12").Characters.Text = ""
Range("A1").Select
End Sub
I then tried this but it keeps leaving a few characters - and is probably not very efficient
Sub ClearAllFileNotes()
Dim txtBox As TextBox
Dim x As Integer
Set txtBox = ActiveSheet.TextBoxes("Text Box 12")
For x = 1 To txtBox.Characters.Count
txtBox.Characters(x).Text = ""
Next
End Sub
Just curious if there is a faster/more efficient way to clear the text in one go.
Thanks for your help.