How copy text in cell if bold and them paste it into another cell on another tab????

kjicha

New Member
Joined
Feb 29, 2016
Messages
41
Hello,

I am in need of the following:

I need to find all the bold text in Column C starting at row 3 and go through till 1000 rows on a tab called "Requirements". Then Copy that text and paste it into another tab called, "Overview", but into a merged cell (which is C & D starting row 29 on this sheet).

Hopefully you can help. Thank you.
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Hi kjicha

Try this
Code:
Sub CopyBold()
Dim myrange As Range
Dim startrow As Long
Dim workrange As Range


startrow = 29
Set workrange = Sheets("Requirement").Range("C3:C1000")
For Each myrange In workrange
    If myrange.Font.Bold Then
        Sheets("Overview").Cells(startrow, 3) = myrange.Value
        startrow = startrow + 1
    End If
Next
End Sub
 
Upvote 0
That worked great, thank you. I do have another question if you don't mind.

So on my Requirements sheet, if C3:C1000 are bold, then I also want it to grab the text in Column C, which you did above, but now also grab the Ref # on that row. The Ref # is in column A starting at row 3. Both then would copy over to the Overview sheet. Starting on the same row of 29. The Ref # should be placed in column B, while the text be placed in column C & D as the are merged.

Thank you.
 
Upvote 0
the numbers are referencing the columns.... 1 = A, 2 = B 3 = C etc....

So if you want to move values in column A from one sheet to column B in the other you can simply modify what Sunny Kow has done. i.e.
Code:
Sheets("Overview").Cells(startrow,[B] [COLOR=#ff0000]2[/COLOR][/B]) =[B][COLOR=#ff0000] myrange.Offset(,-2).Value [/COLOR][/B] [COLOR=#008000]'-2 signifies two columns to the left of C...i.e.   Column A[/COLOR]
 
Upvote 0
Now, what if I switched it. Meaning, if there is text starting in row 29 on sheet "Overview", then copy the data in columns B, C & D (as C & D are merged), and paste the date into the "Requirements Spreadsheet, where ever the next blank line is starting with row 3. Data in Column B from the Overview tab will need to go in column A on the Requirements tab and data in C & D will need to go into column C on the Requirements tab. Then that text that got pasted into column C would need to get bolded.

Hope that makes sense. Thank you in advance.
 
Upvote 0
If your not testing cells to see if they are bold then you don't really need a loop. Here are a few options.


Code:
[COLOR=#0000ff]Sub [/COLOR]GreatDescription()


  [COLOR=#0000ff]  Dim [/COLOR]IntLp [COLOR=#0000ff]As Integer[/COLOR]
[COLOR=#0000ff]    Dim[/COLOR] startrow [COLOR=#0000ff]As Integer[/COLOR]
[COLOR=#0000ff]    Dim[/COLOR] endRow [COLOR=#0000ff]As Integer[/COLOR]
[COLOR=#0000ff]    Dim[/COLOR] pstRow[COLOR=#0000ff] As Integer[/COLOR]
    
    startrow = 29
    endRow = 1000
    pstRow = 3
[COLOR=#008000]    [/COLOR]
[COLOR=#008000]    'Loop through values and copy and paste[/COLOR]
[COLOR=#0000ff]    For[/COLOR] IntLp = startrow [COLOR=#0000ff]To [/COLOR]endRow
        Sheets("Requirements").Cells(pstRow, "A") = Sheets("Overview").Cells(IntLp, "B")
        Sheets("Requirements").Cells(pstRow, "C") = Sheets("Overview").Cells(IntLp, "C")
        Sheets("Requirements").Cells(pstRow, "C").Font.Bold = True 'Make Bold
        pstRow = pstRow + 1[COLOR=#008000] 'Increment Paste Row[/COLOR]
[COLOR=#0000ff]    Next [/COLOR]IntLp


[COLOR=#0000ff]End Sub[/COLOR]

Code:
[COLOR=#0000ff]Sub [/COLOR][COLOR=#000000]AwesomeDescription[/COLOR][COLOR=#0000ff][/COLOR]()
[COLOR=#006400]
[/COLOR]
[COLOR=#006400]'Copy and Paste FASTER.....no loop needed[/COLOR]
Sheets("Overview").Range("B29:B" & Sheets("Overview").Range("B" & Rows.Count).End(xlUp).Row).Copy Sheets("Requirements").Range("A3")
Sheets("Overview").Range("C29:C" & Sheets("Overview").Range("C" & Rows.Count).End(xlUp).Row).Copy Sheets("Requirements").Range("C3")
Sheets("Requirements").Range("C3:C" & Range("C" & Rows.Count).End(xlUp).Row).Font.Bold = [COLOR=#0000ff]True[/COLOR]


[COLOR=#0000ff]End Sub[/COLOR]
 
Upvote 0

Forum statistics

Threads
1,223,904
Messages
6,175,295
Members
452,633
Latest member
DougMo

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