do you wan to insert rows above a1 only

 try this

Sub Macro1()
Dim i As Long
Dim Z As Long
i = 1
If Sheets(1).Cells(1, 1).Value = #5:30:00 AM# Then

    Rows("1:1").Select
    Selection.Insert Shift:=xlDown

 ElseIf Sheets(1).Cells(1, 1).Value = #6:00:00 AM# Then

    Rows("1:2").Select
    Selection.Insert Shift:=xlDown


    ElseIf Sheets(1).Cells(1, 1).Value = #6:30:00 AM# Then

    Rows("1:3").Select
    Selection.Insert Shift:=xlDown

    ElseIf Sheets(1).Cells(1, 1).Value = #7:00:00 AM# Then

    Rows("1:4").Select
    Selection.Insert Shift:=xlDown


    End If



End Sub


On Wed, Feb 9, 2011 at 8:34 AM, Sabosis <scott.s...@henryschein.com> wrote:

> Ashish, thanks for the reply. My only concern is that in the sample
> provided, it looks like it was inserting rows at each half hour interval
> from 5:00 - 7:00. I only want this to happen once, based on the A1 value. If
> A1 if 6:00, insert two rows above, but don't do anything for 6:30 & 7:00. I
> hope that makes sense, I just need to evaluate A1 and nothing else.
>
> Thanks
>
> Scott
>
> --
>
> ----------------------------------------------------------------------------------
> Some important links for excel users:
> 1. Follow us on TWITTER for tips tricks and links :
> http://twitter.com/exceldailytip
> 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
> 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
>
> <><><><><><><><><><><><><><><><><><><><><><>
> Like our page on facebook , Just follow below link
> http://www.facebook.com/discussexcel
>



-- 
*Regards*
* *
*Ashish Koul*
*akoul*.*blogspot*.com <http://akoul.blogspot.com/>
*akoul*.wordpress.com <http://akoul.wordpress.com/>
My Linkedin Profile <http://in.linkedin.com/pub/ashish-koul/10/400/830>


P Before printing, think about the environment.

-- 
----------------------------------------------------------------------------------
Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links : 
http://twitter.com/exceldailytip
2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
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

<><><><><><><><><><><><><><><><><><><><><><>
Like our page on facebook , Just follow below link
http://www.facebook.com/discussexcel

Reply via email to