![]() |
insert row within function
I need a formula that would insert a blank row above the row that contains a
specific value. ie, if a cell contains "x", insert a blank row above it. Or, the same in a macro. Thanks, chris |
Here's a macro someone gave me........it will look for the word "Total" in
either column 3 (C) or column 8 (H) and if found will BOLD the text in that row and add a blank row ..... Sub AddRows() 'Adds blank rows to the sheet for easier reading 'Also changes font on the first 30 columns from the left to BOLD Dim lastrow As Long Dim r As Long lastrow = Range("x" & Rows.Count).End(xlUp).Row For r = lastrow To 2 Step -1 If InStr(1, Cells(r, 3).Value, "Total") 0 Or _ InStr(1, Cells(r, 8).Value, "Total") 0 Then Range(Cells(r, 1), Cells(r, 30)).Font.Bold = True '30 is number 'of columns from "A" that the macro will BOLD ActiveSheet.Rows(r + 1).EntireRow.Insert End If Next End Sub it can be run multiple times for more blank rows..........you can modify it to fit your purposes........ hth Vaya con Dios, Chuck, CABGx3 "c_sports" wrote in message ... I need a formula that would insert a blank row above the row that contains a specific value. ie, if a cell contains "x", insert a blank row above it. Or, the same in a macro. Thanks, chris |
All times are GMT +1. The time now is 03:24 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com