ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Prefill a text box on a form (https://www.excelbanter.com/excel-programming/395798-prefill-text-box-form.html)

Mike H.

Prefill a text box on a form
 
I want to prefill a textbox with data from the excel file and I do not want
the user to be able to change the data in this box. How do i do this?

Pranav Vaidya

Prefill a text box on a form
 
Here's what you need to do.

Assume that the data you want to use to pre-fill the text box is in cell A2

Textbox1.Text=Range("A2").Value

Secondly, set the 'Locked' or 'Enabled' property of the text box to TRUE.
--
Pranav Vaidya
VBA Developer
PN, MH-India
If you think my answer is useful, please rate this post as an ANSWER!!


"Mike H." wrote:

I want to prefill a textbox with data from the excel file and I do not want
the user to be able to change the data in this box. How do i do this?


Mike H.

Prefill a text box on a form
 
The cell has numbers in it. Should it prefill with numbers okay or do I need
to convert to text via the str() function?

"Pranav Vaidya" wrote:

Here's what you need to do.

Assume that the data you want to use to pre-fill the text box is in cell A2

Textbox1.Text=Range("A2").Value

Secondly, set the 'Locked' or 'Enabled' property of the text box to TRUE.
--
Pranav Vaidya
VBA Developer
PN, MH-India
If you think my answer is useful, please rate this post as an ANSWER!!


"Mike H." wrote:

I want to prefill a textbox with data from the excel file and I do not want
the user to be able to change the data in this box. How do i do this?



All times are GMT +1. The time now is 04:36 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com