Results 1 to 9 of 9

End If without block If

Threaded View

  1. #1
    Registered User
    Join Date
    05-08-2013
    Location
    Bristol, UK
    MS-Off Ver
    Excel 16.94
    Posts
    48

    End If without block If

    Part of a macro is below. There is an alternative block for 'PN. To get over the problem do I have to put "End if" after " ActiveSheet.Paste" then begin another "If" block? I'd prefer a method of putting both paragraphs within the 1 "IF", just for convenience/ brevity.

    'EN
    If Range("aaj1") = 1 Then
    Range("aai3:aai182").Select
    Selection.Copy
    Range("k3:aag182").Select
    Selection.PasteSpecial Paste:=xlFormats, Operation:=xlNone, SkipBlanks:= _
    False, Transpose:=False
    ActiveSheet.Paste

    Range("g3:aal182").Select
    ActiveWorkbook.Worksheets("NewData").Sort.SortFields.Clear
    ActiveWorkbook.Worksheets("NewData").Sort.SortFields.Add Key:=Range( _
    "aaj3:aaj182"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
    xlSortNormal
    With ActiveWorkbook.Worksheets("NewData").Sort
    .SetRange Range("g3:AAL182")
    .Header = xlNo
    .MatchCase = False
    .Orientation = xlTopToBottom
    .SortMethod = xlPinYin
    .Apply

    Range("aaj3:aaj32").Select
    Selection.Copy
    Range("k3:aag32").Select
    ActiveSheet.Paste
    End If
    Last edited by tays01s; 05-12-2013 at 02:13 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