ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   converting number to string (https://www.excelbanter.com/excel-programming/288926-converting-number-string.html)

No Name

converting number to string
 
I am using VB in Excel and have this follwing formula
which is giving me problems.

As far as I understand of VB the varible qty has to be
interger to add, but I think it needs to be a string for
the value to be combined with the other text to form the
control source. I may be way off base here, but I think I
am close. Please help. Thank you.


Dim qty As Integer
cc = TextBox11.Value
qty = (10 + ((cc - 1) * 14))
TextBox12.ControlSource = "Scrinput!b" + qty

tolgag[_15_]

converting number to string
 
Try this :
TextBox12.ControlSource = "Scrinput!b" & qty


---
Message posted from http://www.ExcelForum.com/


Bernie Deitrick

converting number to string
 
Try this:

TextBox12.ControlSource = "Scrinput!b" + CStr(qty)

HTH,
Bernie
MS Excel MVP

wrote in message
...
I am using VB in Excel and have this follwing formula
which is giving me problems.

As far as I understand of VB the varible qty has to be
interger to add, but I think it needs to be a string for
the value to be combined with the other text to form the
control source. I may be way off base here, but I think I
am close. Please help. Thank you.


Dim qty As Integer
cc = TextBox11.Value
qty = (10 + ((cc - 1) * 14))
TextBox12.ControlSource = "Scrinput!b" + qty




Bernie Deitrick

converting number to string
 
I should have also noted that changing the controlsource through code
doesn't "stick" ....It will revert to the value from design time when
you unload the userform.

HTH,
Bernie
MS Excel MVP

"Bernie Deitrick" <deitbe @ consumer dot org wrote in message
...
Try this:

TextBox12.ControlSource = "Scrinput!b" + CStr(qty)

HTH,
Bernie
MS Excel MVP

wrote in message
...
I am using VB in Excel and have this follwing formula
which is giving me problems.

As far as I understand of VB the varible qty has to be
interger to add, but I think it needs to be a string for
the value to be combined with the other text to form the
control source. I may be way off base here, but I think I
am close. Please help. Thank you.


Dim qty As Integer
cc = TextBox11.Value
qty = (10 + ((cc - 1) * 14))
TextBox12.ControlSource = "Scrinput!b" + qty






No Name

converting number to string
 
the CSTr worked. Thank you.


-----Original Message-----
Try this:

TextBox12.ControlSource = "Scrinput!b" + CStr(qty)

HTH,
Bernie
MS Excel MVP

wrote in message
...
I am using VB in Excel and have this follwing formula
which is giving me problems.

As far as I understand of VB the varible qty has to be
interger to add, but I think it needs to be a string

for
the value to be combined with the other text to form

the
control source. I may be way off base here, but I

think I
am close. Please help. Thank you.


Dim qty As Integer
cc = TextBox11.Value
qty = (10 + ((cc - 1) * 14))
TextBox12.ControlSource = "Scrinput!b" + qty



.


John Tjia

converting number to string
 
Try it with an ampersand "&"

TextBox12.ControlSource = "Scrinput!b" & qty



wrote in message ...
I am using VB in Excel and have this follwing formula
which is giving me problems.

As far as I understand of VB the varible qty has to be
interger to add, but I think it needs to be a string for
the value to be combined with the other text to form the
control source. I may be way off base here, but I think I
am close. Please help. Thank you.


Dim qty As Integer
cc = TextBox11.Value
qty = (10 + ((cc - 1) * 14))
TextBox12.ControlSource = "Scrinput!b" + qty



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

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