Hello!
I've been stuck on this one task for a while now and I was hoping to get some help.
I currently have a spreadsheet of data ranging from A1:AF60, some of which are in BOLD text. I need to loop through each cell in the entire spreadsheet and select the entire row if that row contains a cell with bold text in it.
I am then required to copy these select rows and paste them in a different workbook.
So far, I have the following code. It stops at the first row and does not loop through the entire sheet. How can I fix this? Any additions to the code is more than welcome.
Thanks!
-Ash
I've been stuck on this one task for a while now and I was hoping to get some help.
I currently have a spreadsheet of data ranging from A1:AF60, some of which are in BOLD text. I need to loop through each cell in the entire spreadsheet and select the entire row if that row contains a cell with bold text in it.
I am then required to copy these select rows and paste them in a different workbook.
So far, I have the following code. It stops at the first row and does not loop through the entire sheet. How can I fix this? Any additions to the code is more than welcome.
Code:
[INDENT]Sub TestLoop()
[/INDENT]
[INDENT=2]Dim LastRow As Long, LastColumn As Long, i As Long, j As Long[/INDENT]
[INDENT=2]LastRow = Range("A" & Rows.Count).End(xlUp).Row[/INDENT]
[INDENT=2]LastColumn = Cells(1, Columns.Count).End(xlToLeft).Column
[/INDENT]
[INDENT=2] For i = 1 To LR
[/INDENT]
[INDENT=2] For j = 1 To LC[/INDENT]
[INDENT=2] If ActiveCell.Font.Bold = True Then
[/INDENT]
[INDENT=2] ActiveCell.EntireRow.Select
[/INDENT]
[INDENT=2] End If
[/INDENT]
[INDENT=2] Next j
[/INDENT]
[INDENT=2] Next i
[/INDENT]
[INDENT]End Sub
[/INDENT]
Thanks!
Last edited: