Hi Ayush/Moderators,

Below is the code you had given me. I changed it to extend the range
and also changed the fixed cell.

All works well, but it is not clearing the contents of the new row
beyond column "Z". If I make the k value larger (instead of 1 to 25, I
put 1 to 37 as I want it till column AN) then I get an error and
beyond column "Z" no contents are cleared in the new row.

Any help will be much appreciated! Thanks again!

********************

Private Sub CommandButton1_Click()

    For i = 1 To 10000
        If ActiveSheet.Range("C" & i).Value = "BLENDING FACILITIES"
Then
            Range("C" & (i + 1) & ":" & "AN" & (i + 1)).Select
            Selection.Copy
            Selection.Insert Shift:=xlDown

            For k = 1 To 25
                If ActiveSheet.Range(Chr(65 + k) & (i + 1)).HasFormula
= False Then
                    ActiveSheet.Range(Chr(65 + k) & (i +
1)).ClearContents
                End If
            Next
            Exit For
        End If
    Next

End Sub

-- 
----------------------------------------------------------------------------------
Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links : 
http://twitter.com/exceldailytip
2. Join our Facebook Group @ http://www.facebook.com/group.php?gid=287779555678
3. Excel tutorials at http://www.excel-macros.blogspot.com
4. Learn VBA Macros at http://www.quickvba.blogspot.com
5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 
To post to this group, send email to excel-macros@googlegroups.com

<><><><><><><><><><><><><><><><><><><><><><>
HELP US GROW !!

We reach over 6,800 subscribers worldwide and receive many nice notes about the 
learning and support from the group.Let friends and co-workers know they can 
subscribe to group at http://groups.google.com/group/excel-macros/subscribe

Reply via email to