Results 1 to 4 of 4

if then else statement not working

Threaded View

cfinch100 if then else statement not... 02-22-2013, 04:22 PM
HaHoBe Re: if then else statement... 02-22-2013, 04:36 PM
cfinch100 Re: if then else statement... 02-22-2013, 04:51 PM
cfinch100 Re: if then else statement... 02-22-2013, 05:19 PM
  1. #1
    Forum Contributor
    Join Date
    10-01-2012
    Location
    england
    MS-Off Ver
    Excel 2016 pro
    Posts
    772

    Post if then else statement not working

    hi


    i have done this statement it copies a range to 3 sheets ,i have put a if then else statement , if yes is on row q3 then only copy rows = to yes
    but now the first statement will not work now,could someone give me some guidance please,have read and downloaded lots of samples,just stuck now
    cheers colin











    Private Sub CommandButton1_Click()
    Dim x As Long, NR As Long, CR As Long, SC As Long
        Dim c As Range
    For Each c In Worksheets("mfr_list").Range("Q3:Q100")
        If c.Value = "Yes" Then
        
    NR = 46
    CR = 3
    SC = 3
      For x = 3 To Sheets("MFR_List").UsedRange.Rows.Count
     If Application.CountBlank(Range(Cells(x, 1), Cells(x, 6))) = 0 Then
     Range(Cells(x, 1), Cells(x, 6)).Copy Sheets("Completed").Cells(CR, "A")
     Range(Cells(x, 1), Cells(x, 6)).Copy Sheets("invoice").Cells(NR, "A")
     Range(Cells(x, 1), Cells(x, 6)).Copy Sheets("stored contracts").Cells(SC, "A")
     Range(Cells(x, 1), Cells(x, 6)).Copy Sheets("Completed").Cells(CR, "A")
    NR = NR + 1
    CR = CR + 1
    SC = SC + 1
    
    
    Else: MsgBox "no copy"
     
    
     End If
     
     Next x
     End If
     Next c
     End Sub
    Last edited by cfinch100; 02-22-2013 at 05:46 PM.

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