Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Data to column by bold letters

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Data to column by bold letters

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

--
Regards,
Tom Ogilvy


"hbamse" wrote:

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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Data to column by bold letters

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

"Tom Ogilvy" wrote:

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

--
Regards,
Tom Ogilvy


"hbamse" wrote:

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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do change a column of data in capitol letters to small letters Barb P. Excel Discussion (Misc queries) 6 November 15th 06 06:17 PM
Capitalizing Letters in multiple column data Karenatallied Excel Worksheet Functions 2 November 14th 06 12:05 AM
Extract bold letters in a cell hbamse Excel Worksheet Functions 1 March 21st 06 08:35 AM
Extract bold letters in a cell Stefi Excel Worksheet Functions 0 March 20th 06 02:51 PM
Auto BOLD max value in a column gevans Excel Worksheet Functions 2 March 6th 06 08:34 PM


All times are GMT +1. The time now is 03:38 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"