I have Excel worksheet that contains a columns with text. Sometimes there is only one cell in the row with text (say, in A2), sometimes there are two two cells (say, A3 “From the beginning”, B3 “to the End”), sometimes three cells (A4 “From”, B4 “the beginning”, C4 “to the End”). Of course, the text is different from cell to cell. I need to write a macro that merge text in one cell (A4 “From the beginning to the End”, B4 and C4 blank) and do it automatically through all column (A). Any help will be greatly appreciated.
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
-
Macro to merge text (Any)
Home » Forums » AskWoody support » Productivity software by function » MS Excel and spreadsheet help » Macro to merge text (Any)
- This topic has 7 replies, 4 voices, and was last updated 22 years, 1 month ago.
Viewing 1 reply threadAuthorReplies-
H. Legare Coleman
AskWoody PlusApril 8, 2003 at 1:01 pm #667035 -
WSkaplinb
AskWoody LoungerApril 8, 2003 at 3:03 pm #667064I want to do it in all non-empty rows: from 2 to 1275, or 1836, or whatever until the cell in column A will be empty. If there is nothing in column B, there is also nothing in column C. There is nothing in column D etc. (The worksheet was created from the text file, last column of which, converted into column A in the worksheet, contained text sometimes with hard returns to wrap it. Text in any cell can start either with capital or lowercase letter. There were too many entries to remove hard returns manually. But I need all text to be in one cell. Blank spaces at the end are not importamt.)
-
WSHansV
AskWoody LoungerApril 8, 2003 at 3:45 pm #667107Something like this?
Sub MergeABC()
Dim aRange As Range
Dim aCell As RangeOn Error GoTo Exit_Sub
Set aRange = Range(Range(“A2”), Range(“A65536”).End(xlUp))
For Each aCell In aRange
If aCell.Offset(0, 1) “” Then
aCell = aCell & ” ” & aCell.Offset(0, 1)
If aCell.Offset(0, 2) “” Then
aCell = aCell & ” ” & aCell.Offset(0, 2)
End If
End If
NextaRange.Offset(0, 1).Clear
aRange.Offset(0, 2).ClearExit_Sub:
Set aCell = Nothing
Set aRange = Nothing
End Sub -
WSServando
AskWoody LoungerApril 8, 2003 at 4:03 pm #667114And what about this:
Sub MergeABC()
Dim aRange As Range
Dim aCell As RangeOn Error GoTo Exit_Sub
Set aRange = Range(Range(“A2”), Range(“A65536″).End(xlUp))
For Each aCell In aRange
aCell = Trim(aCell & ” ” & aCell.Offset(0, 1) & ” ” & aCell.Offset(0, 2))
NextaRange.Offset(0, 1).Clear
aRange.Offset(0, 2).ClearExit_Sub:
Set aCell = Nothing
Set aRange = Nothing
End Sub
-
-
-
-
WSHansV
AskWoody LoungerApril 8, 2003 at 1:19 pm #667033
Viewing 1 reply thread -

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
Marriage Counseling – Manages To Do It Save Our Marriage? (Awaiting moderation)
by
lynwoodspellman
56 minutes ago -
Where’s the cache today?
by
Up2you2
49 minutes ago -
Ascension says recent data breach affects over 430,000 patients
by
Nibbled To Death By Ducks
7 hours, 55 minutes ago -
Nintendo Switch 2 has a remote killing switch
by
Alex5723
8 hours, 15 minutes ago -
Blocking Search (on task bar) from going to web
by
HenryW
1 hour, 30 minutes ago -
Windows 10: Microsoft 365 Apps will be supported up to Oct. 10 2028
by
Alex5723
18 hours, 3 minutes ago -
Add or Remove “Ask Copilot” Context Menu in Windows 11 and 10
by
Alex5723
18 hours, 10 minutes ago -
regarding april update and may update
by
heybengbeng
19 hours, 39 minutes ago -
MS Passkey
by
pmruzicka
24 minutes ago -
Can’t make Opera my default browser
by
bmeacham
1 day, 3 hours ago -
*Some settings are managed by your organization
by
rlowe44
14 hours, 2 minutes ago -
Formatting of “Forward”ed e-mails
by
Scott Mills
1 day, 2 hours ago -
SmartSwitch PC Updates will only be supported through the MS Store Going Forward
by
PL1
1 day, 21 hours ago -
CISA warns of hackers targeting critical oil infrastructure
by
Nibbled To Death By Ducks
2 days, 6 hours ago -
AI slop
by
Susan Bradley
50 minutes ago -
Chrome : Using AI with Enhanced Protection mode
by
Alex5723
2 days, 8 hours ago -
Two blank icons
by
CR2
19 hours, 56 minutes ago -
Documents, Pictures, Desktop on OneDrive in Windows 11
by
ThePhoenix
2 days, 17 hours ago -
End of 10
by
Alex5723
2 days, 19 hours ago -
Single account cannot access printer’s automatic duplex functionality
by
Bruce
1 day, 17 hours ago -
test post
by
gtd12345
3 days, 1 hour ago -
Privacy and the Real ID
by
Susan Bradley
2 days, 15 hours ago -
MS-DEFCON 2: Deferring that upgrade
by
Susan Bradley
18 hours, 16 minutes ago -
Cant log on to oldergeeks.Com
by
WSJonharnew
3 days, 6 hours ago -
Upgrading from Win 10
by
WSjcgc50
1 day, 17 hours ago -
USB webcam / microphone missing after KB5050009 update
by
WSlloydkuhnle
1 day, 21 hours ago -
TeleMessage, a modified Signal clone used by US government has been hacked
by
Alex5723
3 days, 21 hours ago -
The story of Windows Longhorn
by
Cybertooth
3 days, 9 hours ago -
Red x next to folder on OneDrive iPadOS
by
dmt_3904
3 days, 23 hours ago -
Are manuals extinct?
by
Susan Bradley
1 day ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.