Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

add number to string

Status
Not open for further replies.

cdulong

Technical User
Nov 18, 2008
80
CA
I currently have this in a macro that will help me disable buttons. what i am trying to accomplish is as each time the loop goes through it will re populate B28 with:

Button 2
Button 3
and so on


a = 2
Do While a <= 10
But = "Button "
But = But & a
Worksheets("Index").Range("b28").Value = But
a = a + 1
Loop


The problem i am haveing is when the code is ran i get an error stating Type Mismatch any help...

THanks,
cdulong
 
changing
But = But & a
to
But = But & str$(a)
might work for you

This old world keeps spinning round - It's a wonder tall trees ain't layin' down
 
thanks but that didn't work I was still giving the same error
 
Which line of code is highlighted when the error raises ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 



What kind of control?

Skip,
[glasses]Don't let the Diatribe...
talk you to death![tongue]

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
there isn't all it gives me is

Runtime error '13':

Type Mismatch
 


Hit your DEBUG button and see the line of code highlighted.

I'm guessing it the But code.

Skip,
[glasses]Don't let the Diatribe...
talk you to death![tongue]

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
From an Excel idiot....

I do not get a Type Mis-match if I have:
Code:
Dim But As String
Dim a As Long
Nor do I get a Type Mis-match if I have:
Code:
Dim But As String
Dim a As String
which makes me wonder what you have But and a declared as.

Gerry
 
Thanks for your help but I ended up scrapping the idea that I going to use.

Thanks,
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top