Results 1 to 5 of 5

I have VBA codes want to add a line in it

Threaded View

  1. #1
    Forum Contributor
    Join Date
    02-04-2013
    Location
    Bangalore
    MS-Off Ver
    Excel 2010
    Posts
    100

    I have VBA codes want to add a line in it

    sir i have a excel file here in drop box for that i have got vba code but i want to add a line after each array
    so that i can recognize the deffrence between them
    the file is in drop box

    https://www.dropbox.com/s/1n1c8k6uck...important.xlsm

    and VBA codes are

    Sub AutoFilter_Array_01()
    On Error Resume Next
    Dim v As Variant
    v = Array("1a", "1b", "2a", "2b", "3a", "3b", "4a", "4b", "5a", "5b", "6a", "6b", _
    "7a", "7b", "8a", "8b", "9a", "9b", "10a", "10b", "11a", "11b", "12a", "12b")
    Dim ws1 As Worksheet, ws2 As Worksheet
    Set ws1 = Sheets("Data") '<<<< Source sheet
    Set ws2 = Sheets("paste") '<<<< Target sheet
    ws1.AutoFilterMode = False
    Dim L1 As Long, L2 As Long
    L1 = ws1.Cells(Rows.Count, "A").End(xlUp).Row
    L2 = 2
    Application.ScreenUpdating = False
    ws2.Cells.ClearContents '<<< delete previous data from Target Sheet
    ws1.Rows(1).Copy
    ws2.Range("A1").PasteSpecial xlPasteValues
    Application.CutCopyMode = False
    For x = 0 To UBound(v)
    ws1.Range("D1:D" & L1).AutoFilter Field:=1, Criteria1:=v(x)
    ws1.Rows(2 & ":" & L1).SpecialCells(xlCellTypeVisible).Copy
    ws2.Cells(L2, 1).PasteSpecial xlPasteValues
    Application.CutCopyMode = False
    ws1.AutoFilterMode = False
    L2 = ws2.UsedRange.Rows.Count + 1
    Next
    ws1.AutoFilterMode = False
    ws2.UsedRange.EntireColumn.AutoFit
    Application.ScreenUpdating = True
    On Error GoTo 0
    End Sub
    thank you in advance
    harish
    Last edited by arlu1201; 05-27-2013 at 10:37 AM. Reason: Use code tags in future.

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