Move Bold Text to Adjacent Cell

Modify_inc

Board Regular
Joined
Feb 26, 2009
Messages
77
Office Version
  1. 2016
Platform
  1. Windows
I'm trying to move only cells in column C that are bold to the adjacent cell B, then plus one roll down so that they align with the non bold text beside it

Ex:
C1 Bold Text Here
C2 Non Bold Text Here
C3 Bold Text Here
C4 Non Bold Text Here

So, I need to get C1 moved to B2, and C3 moved to B4. This pattern continues for 500 times.
Basically, all the odd numbers are bold, and the even are non bold.

I'm able to get them moved to the B column, but I haven't figured out how to get them aligned up as I stated above. My vba is severely lacking, but here is what I have so far. Any suggestions would be awesome!

Code:
Sub Move_Bold()
    For Each cell In [C3:C500]
        If cell.Font.Bold = True Then
            Debug.Print cell.Row
            cell.Cut Range("B" & Range("B65536").End(xlUp).Row + 1)
        End If
    Next cell
End Sub
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Try
Your example starts in C1 but your code only looks ad C3:C500. I left the range in the code if need adjust the range in the for each cell

Code:
Sub Move_Bold()
    For Each cell In [C3:C500]
        If cell.Font.Bold = True Then
            cell.Cut Range("B" & cell.Row + 1)
        End If
    Next cell
End Sub
 
Upvote 0
Works great..Thank you!
You might find this non-looping macro to be of interest as well...
Code:
[table="width: 500"]
[tr]
	[td]Sub Move_Bold()
  With Range("C3:C500")
    .Copy Range("B4")
    Application.FindFormat.Clear
    Application.FindFormat.Font.Bold = True
    .Replace "", "", SearchFormat:=True, ReplaceFormat:=False
    Application.FindFormat.Clear
    .SpecialCells(xlBlanks).Offset(, -1).ClearContents
  End With
End Sub[/td]
[/tr]
[/table]
 
Last edited:
Upvote 0
Thank you for the code. I'm curious, is non looping code better, faster, safer, recommended over code that loops?
 
Upvote 0
Thank you for the code. I'm curious, is non looping code better, faster, safer, recommended over code that loops?

Sometimes it's better, sometimes not, it depends on the data being looped and/or the number of cells involved. In your case, for so few cells, I'd guess you would not see any difference between the code's times to execute.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top