Results 1 to 2 of 2

Creating a function

Threaded View

  1. #1
    Registered User
    Join Date
    05-15-2013
    Location
    New Delhi, India
    MS-Off Ver
    Excel 2007
    Posts
    32

    Creating a function

    I want to create a function for the following code. Is it possible?

    Sheets("Sample data").Select
        Range("B6:T6").Select
        Selection.AutoFilter
        ActiveSheet.Range("$B$6:$T$500").AutoFilter Field:=10, Criteria1:=Sheets("analyst Report").Range("C2")
        ActiveSheet.Range("$B$6:$T$500").AutoFilter Field:=1, Criteria1:=">=" & r, Operator:=xlAnd, Criteria2:="<=" & s, Operator:=xlFilterValues
        Range("I6").Select
        Selection.End(xlDown).Select
        If IsEmpty(ActiveCell) = True Then
        Sheets("analyst report").Select
        Range("C3").Value = "No activity in current period"
        
        ElseIf ActiveCell.Row = 7 Then
        Range("I7").Select
        Selection.Copy
        Sheets("Analyst Report").Select
        Range("c10").Select
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
        Sheets("Sample data").Select
        Range("N7:T7").Select
        Selection.Copy
        Sheets("Analyst Report").Select
        Range("D10").Select
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
        
        Sheets("Sample data").Select
        Range("A6").Select
        
        Sheets("Analyst Report").Select
        Range("I24").Select
        
        
        ElseIf IsEmpty(ActiveCell) = False Then
        Range("I7").Select
        Range(Selection, Selection.End(xlDown)).Select
        Selection.Copy
        Sheets("Analyst Report").Select
        Range("c10").Select
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
        Sheets("Sample data").Select
        Range("N7:T7").Select
        Range(Selection, Selection.End(xlDown)).Select
        Selection.Copy
        Sheets("Analyst Report").Select
        Range("D10").Select
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False:
    Last edited by rbs123; 07-03-2013 at 12:58 AM. Reason: adding code tags

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