|
-
Jan 24th, 2011, 08:36 AM
#1
Thread Starter
Lively Member
[RESOLVED] How to join the contents of two cells into one?
Hello,
I tried:
Code:
Sub combine()
Dim str(1 To 2) As String 'create the matrix
Dim final As String 'create the string
str(1) = ActiveCell.Text 'takes the value
str(2) = ActiveCell.Offset(0, 1).Text 'takes the other
final = Join(str, " ") 'join
ActiveCell.Offset(0, 1).Text = final 'print
End Sub
But it results in error 424
-
Jan 24th, 2011, 08:44 AM
#2
Thread Starter
Lively Member
Re: How to join the contents of two cells into one?
But it works with ActiveCell.Offset(0, 1) = final instead of ActiveCell.Offset(0, 1).Text = final
-
Jan 25th, 2011, 05:11 AM
#3
Re: How to join the contents of two cells into one?
the text property of cells is read only
it is used to read the displayed (formatted), content of the cell, assigned by the value property
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Jan 25th, 2011, 10:36 AM
#4
Thread Starter
Lively Member
Re: How to join the contents of two cells into one?
Thanks. Now that I understand the difference among. text,. value,. and formula. FormulaR1C1
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|