ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help with userform (https://www.excelbanter.com/excel-programming/346576-help-userform.html)

Mike Grant

Help with userform
 
i have created a userform that has 10 text boxes, is it possible to get
these text boxese to read information from 10 cells, so that the
information from the cells will become the contents of the text box.

any help would be appreciated, thanks in advance


Norman Jones

Help with userform
 
Hi Mike,

Try something like:

Me.TextBox1.Text = Range("A1").Value


---
Regards,
Norman


"Mike Grant" wrote in message
ups.com...
i have created a userform that has 10 text boxes, is it possible to get
these text boxese to read information from 10 cells, so that the
information from the cells will become the contents of the text box.

any help would be appreciated, thanks in advance




Mike Grant

Help with userform
 
the help is much appreciated, but i get an error saying, "compile
Error: invalid use of the Me keyword

i'm fairly puzzled.


svhell

Help with userform
 
You can use the command:
for example for the range "A1:A10"
Dim i As Single

For i = 1 To 10
Me.Controls("TextBox" & i).Value = Cells(i, 1).Value
Next i

with regards Steven


Norman Jones

Help with userform
 
Hi Mike,

Did you put the code in the Userform's code module?

As an exanple, the following worked for me:

'===========
Private Sub UserForm_Initialize()
Me.TextBox1.Text = Range("A1").Value
End Sub
'<<===========


---
Regards,
Norman


"Mike Grant" wrote in message
oups.com...
the help is much appreciated, but i get an error saying, "compile
Error: invalid use of the Me keyword

i'm fairly puzzled.




Mike Grant

Help with userform
 
Thank you both for your hasty replies,

Svhell: your method was a bit OTT for what i was looking for. but i
still want to say a hug thank you to you, as you replied quickly.

Norman: i used your method as you stated in the second post, and this
gave me the correct result. and i would also like to thank you for the
hasty reply.



All times are GMT +1. The time now is 12:15 AM.

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