View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein \(MVP - VB\)[_2077_] Rick Rothstein \(MVP - VB\)[_2077_] is offline
external usenet poster
 
Posts: 1
Default ReadOnly TextBox from ControlSource

You missed the intent of Dave's opening sentence... he suggested that you
NOT use the ControlSource at all... instead, just use the code he provided
to assign the current value in the cell to the TextBox (or, in this case,
the Label) when the UserForm initializes.

Rick


wrote in message
...
On Jun 5, 8:58 pm, Dave Peterson wrote:
Drop the ControlSource and just populate the textbox via code:

Option Explicit
Private Sub UserForm_Initialize()
With Me.TextBox1
.Value = ActiveWorkbook.Worksheets("Sheet1").Range("a1").Te xt
.Enabled = False
End With
End Sub

Have you thought of using a Label instead of a textbox?



wrote:

Hello,


I have a TextBox in a Form that has the ControlSource property set to
read values from a Cell which has a formula.


I have set Enabled to "false" so that users cannot enter data in the
TextBox. (read-only from the cell)


Somehow the formula in the linked cell is replaced by the value. Looks
like the textbox is pushing the value to the cell.


How can I prevent the TextBox to put any value into the LinkedCell.
(It should just display whatever value is in the linked cell not not
clear the formula)


Thankyou.
Gap


--

Dave Peterson


Thanks Dave.
Yes thought about the Label, but it doesn't have a ControlSource.
How to link a label to a Cell?