edit text in a cell with text from another cell

victorcarreto

New Member
Joined
Jun 28, 2012
Messages
7
Hello can any one help me I want to use exel to align two texts. Anyways, I am looking for a way to take the text on cell A2 to the end of the text on cell A1, and delete A2, shifting the other cells up. Is it possible to do it by using a shortcut key? How can I do this?

I really apreciate any help.
Regards

Vic.-
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Hi victorcarreto,

Here's a little macro if you really want to do that:

Code:
Sub CombinenShift(): Dim S As String
S = Range("A1") & " " & Range("A2")
Range("A1") = S
Range("2:2").EntireRow.Delete Shift:=xlUp
End Sub
 
Upvote 0
Hi xladept,

thank you for your reply... I appreciate it very much.

I just have one question, will this code you just give me, will work for any cell? lets say that now I am on B301 and I want to add the text on cell B301 to the text on B300 and then delete B301 shifting the cells up? or this macro will only work for cells A1 and A2?

Regards

Vic.-
 
Upvote 0
It might work with any cell combination as long as you select the top one - but here's one that should work for sure:

Code:
Sub CombinenShift(): Dim S As String
S = ActiveCell & " " & ActiveCell.Offset(1, 0)
ActiveCell = S
ActiveCell.Offset(1, 0).EntireRow.Delete Shift:=xlUp
End Sub
 
Upvote 0
IT WORKS...

thank yo so much...

In case I want to delete just that one cell, and not the entire row, can I just change EntireRow for ActiveCell?
 
Upvote 0
Hi victorcarreto,

Yes but you probably just want to erase it:


Code:
Sub CombinenShift(): Dim S As String 
S = ActiveCell & " " & ActiveCell.Offset(1, 0) 
ActiveCell = S 
ActiveCell.Offset(1, 0).ClearContents 
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top