Results 1 to 2 of 2

Provide user defined function for below vba code

Threaded View

  1. #1
    Registered User
    Join Date
    08-16-2011
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    28

    Provide user defined function for below vba code

    please provide user defined function for below code this code is to generate sheet automatically of filter value. i also attached the file where this code apply

    thanks



    Option Explicit
    Sub Copy_To_Workbooksmod()

    Dim Rng As Range, x, i&
    Application.DisplayAlerts = False
    Application.ScreenUpdating = False

    Set Rng = Sheets("ALL BANK 2012").Range("A1:G" & Sheets("ALL BANK 2012").Range("A" & Rows.Count).End(xlUp).Row)

    Rng.Parent.AutoFilterMode = False

    With CreateObject("Scripting.Dictionary")
    .CompareMode = 1

    x = Sheets("ALL BANK 2012").Range("A1:G" & Sheets("ALL BANK 2012").Range("A" & Rows.Count).End(xlUp).Row)
    For i = 2 To UBound(x)
    If Len(x(i, 6)) Then
    If Not .Exists(Trim$((x(i, 6)))) Then
    .Item(Trim$(x(i, 6))) = Empty

    Rng.AutoFilter 6, "=" & Replace(Replace(Replace(x(i, 6), "~", "~~"), "*", "~*"), "?", "~?")

    If Not Evaluate("ISREF('" & x(i, 6) & "'!A1)") Then
    Worksheets.Add(after:=Worksheets(Worksheets.Count)).Name = x(i, 6)
    Else
    Sheets(x(i, 6)).UsedRange.ClearContents
    End If
    With Worksheets(x(i, 6))
    Rng.SpecialCells(xlCellTypeVisible).Copy
    .Range("A1").PasteSpecial xlPasteValues
    .Range("A1").PasteSpecial xlPasteFormats
    .Columns.AutoFit
    End With
    Application.CutCopyMode = False

    Rng.AutoFilter Field:=6
    End If
    End If
    Next i
    End With

    Rng.Parent.AutoFilterMode = False

    Application.DisplayAlerts = True
    Application.ScreenUpdating = True
    End Sub
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] User defined function returns an error on a standard function used in it.
    By pb48 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-23-2013, 01:35 PM
  2. User Defined Function
    By efernandes67 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-06-2010, 01:57 AM
  3. [SOLVED] Excel - User Defined Function Error: This function takes no argume
    By BruceInCalgary in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-18-2006, 04:05 PM
  4. [SOLVED] user defined function
    By delmac in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-11-2006, 11:35 AM
  5. Need to open the Function Arguments window from VBA for a user defined function.
    By korrin.anderson@gmail.com in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-20-2006, 10:55 AM

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