View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
James Ravenswood James Ravenswood is offline
external usenet poster
 
Posts: 143
Default TextBox Updating within for loop

On Dec 22, 12:30*pm, tomcee wrote:
Why is the textbox not updated until the loop(or the sub?) is exited?
The Cell is updated, but not the TextBox.

Can this be 'fixed'?

================================================== ==
Private Sub CommandButton1_Click()
Dim x9 As Single
Dim i9 As Integer
Dim s9 As Integer

Dim Header$(4)

For i9 = 1 To 4
*s9 = InputBox("Please input a number:", "InputBox Title", 65)
*Cells(10, 2) = s9
*Cells(10, 3) = Chr(s9)
*TextBox1.Value = Chr(s9)
*x9 = DoEvents()

Next i9

End Sub
==================================================

Thanks,
TomC


Hi:Tom

You need to coherse the TextBox a little stronger:

Sub dural()
Dim s As String, num As Integer
For i = 1 To 4
num = Application.InputBox(prompt:="Please input a number",
Type:=1)
s = Chr(num)
With ActiveSheet.Shapes("TextBox 1")
.TextFrame.Characters.Text = s
End With
DoEvents
Application.ScreenUpdating = False
Application.ScreenUpdating = True
Next
End Sub