![]() |
Insert Blank Line after the Word Category is found
I need to be able to insert a blank line each time the word Category is found
in Column B. How would I write this code Thanks |
Insert Blank Line after the Word Category is found
Sub InsertRow()
Dim oCell As Range Columns("B:B").Select For Each oCell In Selection If oCell.FormulaR1C1 = "Category" Then oCell.Select ActiveCell.Offset(1, 0).Select Selection.EntireRow.Insert End If Next End Sub "Nigel" wrote: I need to be able to insert a blank line each time the word Category is found in Column B. How would I write this code Thanks |
Insert Blank Line after the Word Category is found
Sub InsertRow()
With Worksheets("Sheet1") lastrow = Worksheets("Sheet1").Cells(Rows.Count, "B").End(xlUp).Row For r = 1 To lastrow If UCase(.Cells(r, "B")) = "CATEGORY" Then .Cells(r, "B").Offset(1, 0).EntireRow.Insert End If Next r End With End Sub "Jim F" wrote: Sub InsertRow() Dim oCell As Range Columns("B:B").Select For Each oCell In Selection If oCell.FormulaR1C1 = "Category" Then oCell.Select ActiveCell.Offset(1, 0).Select Selection.EntireRow.Insert End If Next End Sub "Nigel" wrote: I need to be able to insert a blank line each time the word Category is found in Column B. How would I write this code Thanks |
All times are GMT +1. The time now is 11:01 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com