1

I am using vba to get combined value in an cell from selection range

what i wanna do is.. i give selection in sheet and run my vba code then in result i would get merged value in an another cell.

but instead of this i am getting value "TRUE"

** in my code i replace enter to comma & for enter i used chr(10).

code i am using is:

Sub abc()
Dim a As String
Dim b As String
a = Selection.Copy
b = Replace(a, Chr(10), ",")
ActiveCell.Offset(4, 0).Value = b
ActiveCell.Offset(4, 1).Value = a
End Sub

image

1 Answer 1

2

Try this:

Sub abc()
    Dim a As String
    Dim b As String
    a = ActiveCell.Value
    b = Replace(a, Chr(10), ",")
    ActiveCell.Offset(4, 0).Value = b
    ActiveCell.Offset(4, 1).Value = a
End Sub
Sign up to request clarification or add additional context in comments.

1 Comment

not working... just giving value of one cell that is in selection as this is copying only selection but i need to copy range of selection...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.