ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   merging (https://www.excelbanter.com/excel-programming/355525-merging.html)

mpele[_4_]

merging
 

I want to merge two cells and that new cell to fill with "asdf".
How could I do that?


--
mpele
------------------------------------------------------------------------
mpele's Profile: http://www.excelforum.com/member.php...o&userid=31808
View this thread: http://www.excelforum.com/showthread...hreadid=520454


Norman Jones

merging
 
Hi M,

I want to merge two cells and that new cell to fill with "asdf".
How could I do that?


Avoiding the temptation to respomd "Don't!", because there are all kinds of
potential problems associated with the use of merged cells, try:

'=============
Public Sub Tester001()
Dim rng As Range

Set rng = Range("A1:B1") '<<==== CHANGE
With Range("B14:C14")
.ClearContents
.Item(1).Value = "asdf"
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = True
End With

End Sub
'<<============



---
Regards,
Norman



"mpele" wrote in
message ...

I want to merge two cells and that new cell to fill with "asdf".
How could I do that?


--
mpele
------------------------------------------------------------------------
mpele's Profile:
http://www.excelforum.com/member.php...o&userid=31808
View this thread: http://www.excelforum.com/showthread...hreadid=520454




Norman Jones

merging
 
Hi M,

With Range("B14:C14")


Should read:

With rng


---
Regards,
Norman



NickHK

merging
 
mpele,
Agreeing with Norman to avoid this unless you really have to, you could have
recorded a macro of the actions and got the answer in all of 10 seconds.
This is the best to start something that you are not sure of. From there,
edit the code as necessary, adding variables, error checks, loops etc to
enhance.

Nick

"mpele" wrote in
message ...

I want to merge two cells and that new cell to fill with "asdf".
How could I do that?


--
mpele
------------------------------------------------------------------------
mpele's Profile:

http://www.excelforum.com/member.php...o&userid=31808
View this thread: http://www.excelforum.com/showthread...hreadid=520454





All times are GMT +1. The time now is 09:11 PM.

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