Hello again,
I am looking for a V.BA Macros to auto Filter data in column A and past in worksheet("datasheet") by column.
copy of the sample sheathes attached for your refference
Hello again,
I am looking for a V.BA Macros to auto Filter data in column A and past in worksheet("datasheet") by column.
copy of the sample sheathes attached for your refference
As a beginner starter paste this demonstration to the Dashboard worksheet module :
PHP Code:
Sub Demo1()
Dim C%, Rg As Range, H%, Rk As Range, R&
C = 1
Me.UsedRange.Clear
Application.ScreenUpdating = False
With Sheets("ST")
.[A1].AutoFilter
Set Rg = .[A1].CurrentRegion
H = Rg.Columns.Count + 1
Set Rk = .Cells(H + 2)
End With
Rg.Columns(1).AdvancedFilter xlFilterCopy, , Rk, True
For R = 2 To Rk.CurrentRegion.Rows.Count - 1
Rg.AdvancedFilter xlFilterCopy, Rk.Resize(2), Cells(C)
Rk(R + 1).Copy Rk(2)
C = C + H
Next
Rk.CurrentRegion.Clear
Set Rg = Nothing: Set Rk = Nothing
Application.ScreenUpdating = True
End Sub
Do you like it ? So thanks to click on bottom left star icon « ★ Add Reputation » !
Thanks marcl,
1 last requirement. Can v copy only first 10 rows if the data is more than 10 rows.
Thanks for ur help
![]()
Option Explicit Sub Extract() Dim val, col As Long, sr As Long, rng As Range: col = 1 With CreateObject("System.Collections.ArrayList") For Each val In Range("A3:A" & Cells(Rows.Count, 1).End(xlUp).Row - 1).Value If Not .contains(val) Then .Add val With Cells(1).CurrentRegion .AutoFilter 1, val sr = Range("A2", Range("A" & Rows.Count).End(xlUp)).SpecialCells(12).Row Set rng = Union(Range("A1:E1"), Range("A" & sr).Resize(10, 5).SpecialCells(12)) rng.Copy Sheet1.Cells(1, col) col = col + 6 End With End If Next val End With Sheet1.UsedRange.Columns.AutoFit Sheet26.AutoFilterMode = False End Sub
Good Luck...
I don't presume to know what I am doing, however, just like you, I too started somewhere...
One-day, One-problem at a time!!!
If you feel I have helped, please click on the [★ Add Reputation] to left of post window...
Also....Add a comment if you like!!!!
And remember...Mark Thread as Solved...
Excel Forum Rocks!!!
Thanks both of u it us working as i expected.
Topic marked as closed and reputation added to both of u.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Thanks.gif
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks