Combining text with an integer

L

Lucas Soler

I currently am using:
xlR.Range("D4:E1000").NumberFormat = "#,##0.0"

But I don't want to limit myself to 1000 rows. I have a counter (i.e.
Counter) that counts that rows and is an Interger. How can I use the
counter? The code below won't work. I suppose I need to convert the Counter
to text, then concatinate? Can you provide the code?

xlR.Range("D4:E" + Counter).NumberFormat = "#,##0.0"

Thanks.
 
E

Earl Lewis

Create (Dim really) Counter as a string and assign a value to it (using quotes to clearly indicate its a string, like this: "12345") then use "&" to concatenate it, not "+".

Earl
I currently am using:
xlR.Range("D4:E1000").NumberFormat = "#,##0.0"

But I don't want to limit myself to 1000 rows. I have a counter (i.e.
Counter) that counts that rows and is an Interger. How can I use the
counter? The code below won't work. I suppose I need to convert the Counter
to text, then concatinate? Can you provide the code?

xlR.Range("D4:E" + Counter).NumberFormat = "#,##0.0"

Thanks.
 
J

Juan Pablo Morales

Lucas Soler said:
xlR.Range("D4:E" + Counter).NumberFormat = "#,##0.0"
Dim counter as Integer
counter = 12345
xlR.Range("D4:E" & CStr(counter)).NumberFormat = "#,##0.0"

That should do the trick, with counter as an integer variable
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top