Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / March 2006

Tip: Looking for answers? Try searching our database.

Data to column by bold letters

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
hbamse - 20 Mar 2006 15:45 GMT
Hello!
I have this column with names and titles:
This great person (bold) System Developer Specialist (not bold)

Can I devide this into two columns with the bold names and the titles not
bold in the other column.

Best regards
/Henrik
Tom Ogilvy - 20 Mar 2006 15:51 GMT
Assumes you won't have any formulas which will be messed up by inserting and
deleting columns.

Sub SplitBold()
Dim cell As Range
Dim l As Long, i As Long
Dim j As Long
Set rng = Range(Cells(1, "A"), Cells(1, "A").End(xlDown))
rng.EntireColumn.Offset(0, 1) _
   .Resize(, 2).Insert
rng.EntireColumn.Offset(0, 1) _
   .Resize(, 2).Font.Bold = False
For Each cell In rng
l = Len(cell)
For i = 1 To l
If cell.Characters(i, 1).Font.Bold Then
 j = i
Else
 Exit For
End If
Next
cell.Offset(0, 1).Value = Trim(Left(cell, j))
cell.Offset(0, 2).Value = Trim(Mid(cell, j + 1, l))
cell.Offset(0, 1).Font.Bold = True
Next cell
rng.EntireColumn.Delete
End Sub

Signature

Regards,
Tom Ogilvy

> Hello!
> I have this column with names and titles:
[quoted text clipped - 5 lines]
> Best regards
> /Henrik
hbamse - 21 Mar 2006 09:49 GMT
This script only works for the first row.
All other data gets lost, about a 1000 records.
No harm done of course, but the script does not work.
Any ideas?
regards /Henrik

> Assumes you won't have any formulas which will be messed up by inserting and
> deleting columns.
[quoted text clipped - 33 lines]
> > Best regards
> > /Henrik
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.