ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy one cell and merge into another (https://www.excelbanter.com/excel-programming/453254-copy-one-cell-merge-into-another.html)

[email protected]

Copy one cell and merge into another
 
Hi,

Is a macro for this possible?

1. Active cell (is a number)
2. 4 cells to the right from active cell (is text)
3. Add the value from the first cell (1) at the end of the text without any
space


Example

Before macro:
First active cell = any number e.g. 458
Four cells to the right = Test/

After macro:
First active cell = 458
Four cells to the right = Test/458 (if possible change 458 to blue colour.

Kaj Pedersen

GS[_6_]

Copy one cell and merge into another
 
Try...

Sub JoinCells_ColorNums()
Dim iPos%
With ActiveCell.Offset(0, 4)
iPos = Len(.value) + 1
.value = .value & ActiveCell.value
.Characters(iPos).Font.Color = vbBlue
End With
End Sub

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion

[email protected]

Copy one cell and merge into another
 
Hi,

Your suggested code did exactly what I wanted. I appreciate it very much.
Thank you.

Best regards,
Kaj Pedersen

GS[_6_]

Copy one cell and merge into another
 
Hi,

Your suggested code did exactly what I wanted. I appreciate it very much.
Thank you.

Best regards,
Kaj Pedersen


You're welcome...

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion


All times are GMT +1. The time now is 04:49 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com