2 VB questions

J

John

alright, for the first question...
i'm trying to write a macro that uses the solver tool.
the problem is that i need to be able to select different
cells to be changed each time depending on the row size
(if that make sense). so in other words, i'm looking for
sample/example code so that i can generically call use
the solver tool.

and for question 2...
i'm trying to take column A, say with 5 cells as shown:

this
is
a
big
pain

now i want to concatenate the cells of column A and put
the result into another cell, say B2, so B2 would look
like :

this is a big pain

any advice or help would be greatly appreciated. thanks

~john
 
J

Jennifer Graham

Question 2:
To get everything in one line, type:
Range("B2") = Range("A1") & " " & Range("A2") & " " & Range
("A3") & " " & Range("A4") & " " & Range("A5")

This adds the spaces in between the words. You can also
used named ranges where I have used B2, A1, etc.
 
F

Frank Kabel

Hi
for your second question try something like

sub foo()
dim rng as range
dim cell as range
dim vres

set rng = activesheet.range("A1:A4")
for each cell in rng
if vres="" then
vres=cell.value
else
vres = vres & " " & cell.value
end if
next
end sub
 
Top