Results 1 to 5 of 5

nested if then else statement

Threaded View

  1. #1
    Forum Contributor
    Join Date
    10-01-2012
    Location
    england
    MS-Off Ver
    Excel 2016 pro
    Posts
    772

    Post nested if then else statement

    hi
    as previous thread i have a code below
    Dim r As Long, endRow As Long, pasteRowIndex As Long
    
    endRow = 100 ' of course it's best to retrieve the last used row number via a function
    pasteRowIndex = 1
    
    For r = 1 To endRow 'Loop through sheet1 and search for your criteria
    
        If Cells(r, Columns("q").Column).Value = "yes" Then 'Found
    
                'Copy the current row
                Rows(r).Select
                Selection.Copy
    
                'Switch to the sheet where you want to paste it & paste
                Sheets("completed").Select
                Rows(pasteRowIndex).Select
                ActiveSheet.Paste
    
                'Next time you find a match, it will be pasted in a new row
                pasteRowIndex = pasteRowIndex + 1
    
    
               'Switch back to your table & continue to search for your criteria
                Sheets("mfr_list").Select
        End If
    Next r
    End Sub

    this copies complete rows if cell q has a value of yes
    question
    i want to only copy the first 6 (a-f)inclusive) cells and cell (q) if cell q is yes and the first 6 cells are populated
    can i add under
    If Cells(r, Columns("q").Column).Value = "yes" Then 'Found  /  If Cells(r, Columns("a").Column).Value = "*" Then 'Found
    not sure what to put in in place of "*"
    also i want , only if the first 6 cells are populated for it to enter a "yes"in cell q then it would run the first code,
    thought this code was a good reference point to start from,looked simple at first but been messing for 8 hrs now and still not there,ive read up on nested funtions
    im lost any help would be great to get me away again
    cheers colin
    Last edited by cfinch100; 02-23-2013 at 08:21 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