ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Textbox Info (https://www.excelbanter.com/excel-programming/340341-textbox-info.html)

oberon.black[_62_]

Textbox Info
 

I am using the following code to get info from a cell in my spreadshee
and add it to my userform textbox:


Code
-------------------

Private Sub CommandButton2_Click()
TextBox2.Text = Range("A12").Value
End

-------------------


-Problem-
I need to have the information from cells 'A12 & E12' inserted in th
textbox and then separated by a comma(,).

Can some one help me with the code for this.

Thank you for your support

--
oberon.blac
-----------------------------------------------------------------------
oberon.black's Profile: http://www.excelforum.com/member.php...fo&userid=2673
View this thread: http://www.excelforum.com/showthread.php?threadid=46838


dominicb[_128_]

Textbox Info
 

Good evening oberon.black

This line should do the trick.

TextBox2.Value = Range("A12") & "," & Range("E12")

HTH

Dominic

--
dominic
-----------------------------------------------------------------------
dominicb's Profile: http://www.excelforum.com/member.php...fo&userid=1893
View this thread: http://www.excelforum.com/showthread.php?threadid=46838


oberon.black[_63_]

Textbox Info
 

Like a charm. But tell me why do I remove the .value

--
oberon.blac
-----------------------------------------------------------------------
oberon.black's Profile: http://www.excelforum.com/member.php...fo&userid=2673
View this thread: http://www.excelforum.com/showthread.php?threadid=46838


Dave Peterson

Textbox Info
 
You want to use:

TextBox2.Value = Range("A12").Value & "," & Range("E12").Value

???

I like to use that syntax, too. .Value is the default property a range object
(so it's not always required).

But I think it makes for better reading/coding to always use the property you
want. You never have to worry about which property you meant.



"oberon.black" wrote:

Like a charm. But tell me why do I remove the .value?

--
oberon.black
------------------------------------------------------------------------
oberon.black's Profile: http://www.excelforum.com/member.php...o&userid=26732
View this thread: http://www.excelforum.com/showthread...hreadid=468380


--

Dave Peterson

oberon.black[_66_]

Textbox Info
 

Ok, Thanks


--
oberon.black
------------------------------------------------------------------------
oberon.black's Profile: http://www.excelforum.com/member.php...o&userid=26732
View this thread: http://www.excelforum.com/showthread...hreadid=468380



All times are GMT +1. The time now is 02:05 AM.

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