+ Reply to Thread
Results 1 to 4 of 4

Create:If Statement

  1. #1
    bodhisatvaofboogie
    Guest

    Create:If Statement

    I want to create a code to put into a macro that does this:

    IF the value in column I is less than 7 Then Delete the cells within that
    row from Column E to Column J and shift the rows to the right over into their
    place.

    Kinda wierd, I know. Don't ask Am I way off to try an If statement,
    or should I go a different route? THANKS!!!

  2. #2
    Forum Contributor
    Join Date
    06-01-2006
    Posts
    324
    Try this:


    If Selection.Value < 7 Then
    Range("E" & Selection.Row & ":" & "J" & Selection.Row).Select
    Selection.Delete Shift:=xlToLeft
    End If
    Google is your best friend!

  3. #3
    Tom Ogilvy
    Guest

    re: Create:If Statement

    sub DeleteStuff()

    Dim lastrow as Long, i as Long
    Dim cell as Range

    lastrow = cells(rows.count,"I").end(xlup).row
    fori = lastrow to 1 step - 1
    set cell = cells(i,"I")
    if isnumeric(cell) then
    if cell < 7 then
    cell.offset(0,-4).Resize(1,6).Delete shift:=xlShiftLeft
    end if
    end if
    Next
    end sub

    --
    Regards,
    Tom Ogilvy

    "bodhisatvaofboogie" wrote:

    > I want to create a code to put into a macro that does this:
    >
    > IF the value in column I is less than 7 Then Delete the cells within that
    > row from Column E to Column J and shift the rows to the right over into their
    > place.
    >
    > Kinda wierd, I know. Don't ask Am I way off to try an If statement,
    > or should I go a different route? THANKS!!!


  4. #4
    ikr
    Guest

    OT


    "bodhisatvaofboogie" <[email protected]>

    a Steely Dan fan?



+ Reply to Thread

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