I'm looking for a way to format textboxes which are linked to cells (with the controlsource-property - sorry JP). The textboxes are created at runtime.
The code I use is like this:
for rij = 1 to 10
.......
for kolom = 1 10 10
.........
txtNr=txtNr+1
Set cTxt = .Frame11.Controls.Add("Forms.Textbox.1", "Textbox" & txtNr, True)
ctrSrc = "Planning!" & Planning.Cells(rij, kolom).Address(True, True)
With cTxt
.Width = 40
.Height = 15
.Top = Boven
.Left = Links
.BackStyle = 0
.BorderStyle = 0
.Font.Name = "Tahoma"
.Font.Size = 7
.TextAlign = 3
.ControlSource = ctrSrc
.Text = Format(Planning.Cells(rij, kolom).Text, "#,##0") 'but this only works the first time as this code is excuted only at startup
next kolom
next rij
Hope for any usefull suggestions.
Bookmarks