Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
c_sports
 
Posts: n/a
Default 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
  #2   Report Post  
CLR
 
Posts: n/a
Default

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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Challenging Charting C TO Charts and Charting in Excel 0 January 17th 05 06:57 PM
Can I change the Insert Function button to an equals sign? Jokeyjojo Excel Discussion (Misc queries) 1 January 17th 05 05:45 PM
Insert Function "FX" on Toolbar in Excel Rich Excel Discussion (Misc queries) 4 January 16th 05 03:04 PM
How do I insert a row when using an if function BP Excel Worksheet Functions 1 December 27th 04 05:15 PM
Function to automatically insert a new sheet as a result of data entry? Mark Mulik Excel Worksheet Functions 2 November 28th 04 02:21 AM


All times are GMT +1. The time now is 09:52 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"