concatenation of cells

G

Gene

I have an integer variable i would like to add to a alpha
character to make a cell reference but I wasn't able to do
it, can it be done. Something like:
While something = something
i = i+1
wend
range("A1:C"&i)sort(key1 = columns("A")

doesn't work but you get the idea
 
T

Tom Ogilvy

It works fine for me:

i = 20
? range("A1:C"&i).Address
$A$1:$C$20


demonstated in the Immediate window. (don't use ? in a module. the
immediate window allows you to test an expression immediately - in case you
are not familiar with the immediate window in the VBE).

Regards,
Tom Ogilvy
 
M

Mark Bigelow

Try this:

While something = something
i = i+1
wend
range("A1:C" & i).sort key1 := columns("A")

The difference is that you must put a period before the sort, you must
use ":=" instead of "=" and the parenthesis are extraneous.

Please let me know if that doesn't work.
 

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