Results 1 to 7 of 7

cycle for

Threaded View

  1. #1
    Forum Contributor
    Join Date
    07-26-2009
    Location
    Slovakia
    MS-Off Ver
    Excel 2019
    Posts
    244

    cycle for

    Hello, I just need solve one simple problem (which drive me mad )
    so I have this code
        If Range("A3").Value <> "Draw" Then Range("A3").EntireRow.Insert Shift:=xlDown
        If Range("A6").Value <> "Draw" Then Range("A6").EntireRow.Insert Shift:=xlDown
        If Range("A9").Value <> "Draw" Then Range("A9").EntireRow.Insert Shift:=xlDown
        If Range("A12").Value <> "Draw" Then Range("A12").EntireRow.Insert Shift:=xlDown
    and I need to do it with command FOR, I try to do it but :
            For lngRow2 = 0 To 500 Step 3
                  
                      If Range("A" & lngRow2).Value <> "Draw" Then
                        Range("A" & lngRow2).EntireRow.Insert Shift:=xlDown
                      End If
            Next
    and there is some error (where?)

    or
            For lngRow2 = 0 To 500
                
                      If Range("A" & lngRow2 + 3).Value <> "Draw" Then Range("A" & lngRow2).EntireRow.Insert Shift:=xlDown
            Next
    but lngrow2 doesnt have +3 each cycle, only +1 ...

    Anyone could help me, please?
    Last edited by miso.dca; 12-07-2009 at 09:31 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1