ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   New Users to Excel (https://www.excelbanter.com/new-users-excel/)
-   -   String variables (https://www.excelbanter.com/new-users-excel/99534-string-variables.html)

John

String variables
 
I dim Warning(100) as string

Then I do the following:

Warning(1) = Cells(1, 3) + " " + Cells(3, 3) + " " + "Assessments" + "=
" + Cells(2, 13) + "," + Cells(2, 16)


Cells (1,3) is a string
Cells(3,3) is a social security number
"Assessments" I mean the word Assessments
Cells(2,13) and Cells(2,16) are numbers


I want Warning(1) to = "Joe Blow 123-45-6789 Assessments 4,5"

I get a type mismatch.

This is old code from Power Basic.

Help and thanks

John


Trevor Shuttleworth

String variables
 
Try using "&" instead of "+" to concatenate the strings

Suspect it's trying to add up and finding data other than numbers

Regards

Trevor


"John" wrote in message
...
I dim Warning(100) as string

Then I do the following:

Warning(1) = Cells(1, 3) + " " + Cells(3, 3) + " " + "Assessments" + "= "
+ Cells(2, 13) + "," + Cells(2, 16)


Cells (1,3) is a string
Cells(3,3) is a social security number
"Assessments" I mean the word Assessments
Cells(2,13) and Cells(2,16) are numbers


I want Warning(1) to = "Joe Blow 123-45-6789 Assessments 4,5"

I get a type mismatch.

This is old code from Power Basic.

Help and thanks

John




John

String variables
 
That fixed it. Thanks

John

Trevor Shuttleworth wrote:
Try using "&" instead of "+" to concatenate the strings

Suspect it's trying to add up and finding data other than numbers

Regards

Trevor


"John" wrote in message
...

I dim Warning(100) as string

Then I do the following:

Warning(1) = Cells(1, 3) + " " + Cells(3, 3) + " " + "Assessments" + "= "
+ Cells(2, 13) + "," + Cells(2, 16)


Cells (1,3) is a string
Cells(3,3) is a social security number
"Assessments" I mean the word Assessments
Cells(2,13) and Cells(2,16) are numbers


I want Warning(1) to = "Joe Blow 123-45-6789 Assessments 4,5"

I get a type mismatch.

This is old code from Power Basic.

Help and thanks

John





Trevor Shuttleworth

String variables
 
You're welcome. Thanks for the feedback


"John" wrote in message
...
That fixed it. Thanks

John

Trevor Shuttleworth wrote:
Try using "&" instead of "+" to concatenate the strings

Suspect it's trying to add up and finding data other than numbers

Regards

Trevor


"John" wrote in message
...

I dim Warning(100) as string

Then I do the following:

Warning(1) = Cells(1, 3) + " " + Cells(3, 3) + " " + "Assessments" + "= "
+ Cells(2, 13) + "," + Cells(2, 16)


Cells (1,3) is a string
Cells(3,3) is a social security number
"Assessments" I mean the word Assessments
Cells(2,13) and Cells(2,16) are numbers


I want Warning(1) to = "Joe Blow 123-45-6789 Assessments 4,5"

I get a type mismatch.

This is old code from Power Basic.

Help and thanks

John






All times are GMT +1. The time now is 11:31 PM.

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