Positioning several values in a cell

  • Thread starter Thread starter Laidback
  • Start date Start date
L

Laidback

Dear all,

I would like to position several values (taken from other cells
(different lengths, but I think that does not matter!) in ONE cell
e.g. value 1 starts in position 1, second value starts in position 20,
third value starts in position 40.

Any suggestions 4 the VBA codes?

Thank u!

L
 
Hi
do you mean a concatenation? if yes try
sub foo()
dim str_value
str_value = range("A2").value & range("C5").value _
& range("G7").value

Range("A1").value = str_value
end sub
 
Dear Frank,

Thank you for your reply. Yes, it is a concatenation. But I would the
also like to positon the values within the cell (Example: Value take
from the first cell should be displayed at the left, then there is
gap. Value from the second cell starts at position 20, and so on).

Cheers, Gruesse nach Frankfurt

L
 
Hi
try
sub foo()
dim str_value
str_value = range("A2").value & string(19-len(range("A2").value)," ") &
range("C5").value _
& string(19-len(range("A2").value)," ") & range("G7").value

Range("A1").value = str_value
end sub
 
Hey Frank,

yup, u got it. This works.
thanks a lot for your help, really appreciate it.

L
 

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

Back
Top