View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Doug Glancy Doug Glancy is offline
external usenet poster
 
Posts: 770
Default vba problem dialogue box and cell in sheet

Jean-Pierre,

Instead of using the ControlSource I'd use two macros like these in the
userform:

Private Sub UserForm_Initialize()
Me.TextBox1.Text = Format(Worksheets("Sheet1").Range("D6"), "0.00%")
End Sub

Private Sub TextBox1_AfterUpdate()
Worksheets("Sheet1").Range("D6") = Me.TextBox1.Text
End Sub

hth,

Doug

"Jean-Pierre" wrote in message
...
Hi,

I'am using a userform with a textbox to have the user input a value.
The textbox has a controlsource in the sheet (cell d6)which is formatted
as
a percentage.

Now: When the user puts in "3", cell D6 is filled with 300% ! This is not
what i want.

So i made a VBA code in the textbox_before_update() section which checks
if
the number put in 1 and then devides it by 100.
This works fine but :

Cell D6 in the worksheet is not updated !
I tried to put the same check code in the textbox_change()section, but
that
did not help.

Any ideas?
Thanks,
Jean-Pierre