Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 06-13-2020, 09:54 AM
Purfleet Purfleet is offline How to remove line between "Black" & "device"? Windows 10 How to remove line between "Black" & "device"? Office 2019
Expert
 
Join Date: Jun 2020
Location: Essex
Posts: 345
Purfleet is a splendid one to beholdPurfleet is a splendid one to beholdPurfleet is a splendid one to beholdPurfleet is a splendid one to beholdPurfleet is a splendid one to beholdPurfleet is a splendid one to beholdPurfleet is a splendid one to behold
Default

Agreed - merged cells are the devils own work and should be avoided

You could do =C4&CHAR(10)&C5 and turn on Wrap text which is much nicer

But if you insist on using merged cells you can select the top cell of the 2 you want merged and run this

Sub MergeCellAndBelow()

Dim r As Range

Dim c1 As String
Dim c2 As String

c1 = ActiveCell.Value


c2 = ActiveCell.Offset(1, 0).Value

Application.DisplayAlerts = False
Range(ActiveCell.Address & ":" & ActiveCell.Offset(1, 0).Address).Merge
Application.DisplayAlerts = True

With ActiveCell
.Value = c1 & Chr(10) & c2
.WrapText = True
End With

End Sub



Its a bit rough and ready but should give you the idea

Last edited by Purfleet; 06-13-2020 at 09:57 AM. Reason: typo
Reply With Quote
  #2  
Old 06-13-2020, 10:22 PM
kingston123 kingston123 is offline How to remove line between "Black" & "device"? Windows 10 How to remove line between "Black" & "device"? Office 2013
Advanced Beginner
How to remove line between "Black" & "device"?
 
Join Date: Sep 2018
Posts: 85
kingston123 is on a distinguished road
Default

Quote:
Originally Posted by Purfleet View Post
You could do =C4&CHAR(10)&C5 and turn on Wrap text which is much nicer

But if you insist on using merged cells you can select the top cell of the 2 you want merged and run this

Sub MergeCellAndBelow()

Dim r As Range

Dim c1 As String
Dim c2 As String

c1 = ActiveCell.Value
c2 = ActiveCell.Offset(1, 0).Value

Application.DisplayAlerts = False
Range(ActiveCell.Address & ":" & ActiveCell.Offset(1, 0).Address).Merge
Application.DisplayAlerts = True

With ActiveCell
.Value = c1 & Chr(10) & c2
.WrapText = True
End With

End Sub

Run where exactly? command prompt?
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
"Magic" indentation for "too-long" text-lines that are longer than one line pGrnd Word 2 04-20-2020 03:23 PM
Combine "sort within groups" and "identify duplicate/unique values" in two different variables. civilcervant Excel 3 06-12-2017 07:27 AM
Replace "comma" with "and" in line of text audioman Word VBA 7 01-21-2016 03:11 PM
remove repeated words with " macro " or " wild cards " in texts with parentheses and commas jocke321 Word VBA 2 12-10-2014 11:27 AM
How to remove line between "Black" & "device"? How to choose a "List" for certain "Heading" from "Modify" tool? Jamal NUMAN Word 2 07-03-2011 03:11 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 08:22 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft