ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA - Move cell contents if bold text (https://www.excelbanter.com/excel-programming/355970-vba-move-cell-contents-if-bold-text.html)

Scott Wagner

VBA - Move cell contents if bold text
 
I have a piece of information (marking) that appears sometimes in column B of
my worksheet one row below a master line. Markings are not always used.
When a marking is present it is always in bold text. I'd like to move the
value from column B to column E and up one row.

For example: (what I have now)
A | B | C | D | E |
1 | 2 | Panelboard | | |
| Marking (bold text) | | | |
| Other entry (not bold text) | | | |

What I would like to end up with:
A | B | C | D | E |
1 | 2 | Panelboard | |Marking (bold text) |
| Other entry (not bold text) | | | |


Thanks in advance!

Scott

Tom Ogilvy

VBA - Move cell contents if bold text
 
lastrow = cells(rows.count,2).End(xlup).row
for i = lastrow to 2 step -1
if cells(i,2).Font.bold then
cells(i-1,5).Value = cells(i,2).Value
rows(i).Delete
end if
Next

--
Regards,
Tom Ogilvy



"Scott Wagner" wrote:

I have a piece of information (marking) that appears sometimes in column B of
my worksheet one row below a master line. Markings are not always used.
When a marking is present it is always in bold text. I'd like to move the
value from column B to column E and up one row.

For example: (what I have now)
A | B | C | D | E |
1 | 2 | Panelboard | | |
| Marking (bold text) | | | |
| Other entry (not bold text) | | | |

What I would like to end up with:
A | B | C | D | E |
1 | 2 | Panelboard | |Marking (bold text) |
| Other entry (not bold text) | | | |


Thanks in advance!

Scott


Scott Wagner

VBA - Move cell contents if bold text
 
Thanks Tom!


All times are GMT +1. The time now is 08:19 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com