ExcelHound
New Member
- Joined
- Jun 4, 2011
- Messages
- 9
I’m looking for assistant with the following macro – this works well but I would like to achieve some small tweaks.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-comfficeffice" /><o></o>
I’m looking for a macro to select to contents of Column ‘A’ on Sheet1 where Sheet1 has an autofilter – Column D is AutoFiltered to only select entries with a ‘Yes’ value. <o></o>
Sheet1 has a Header starting at row A5. Sheet1 has multiple columns of data included in the AutoFilter but I only want to select the filtered result of column A (minus the header) then paste it onto Sheet2 at A5 (the next free cell).
<o></o>
Is this possible? Many thanks in advance.<o></o>
<o> </o>
The macro works fine but copies all columns, I just want to copy column A.<o></o>
Sub CopyFilter()<o></o>
Dim rng As Range<o></o>
Dim rng2 As Range<o></o>
<o> </o>
With ActiveSheet.AutoFilter.Range<o></o>
On Error Resume Next<o></o>
Set rng2 = .Offset(1, 0).Resize(.Rows.Count - 1, 1) _<o></o>
.SpecialCells(xlCellTypeVisible)<o></o>
On Error GoTo 0<o></o>
<o> </o>
End With<o></o>
<o> </o>
If rng2 Is Nothing Then<o></o>
MsgBox "No data to copy"<o></o>
<o> </o>
Else<o></o>
Worksheets("Sheet2").Cells.Clear<o></o>
Set rng = ActiveSheet.AutoFilter.Range<o></o>
rng.Offset(1, 0).Resize(rng.Rows.Count - 1).Copy _<o></o>
Destination:=Worksheets("Sheet2").Range("A1")<o></o>
I’m looking for a macro to select to contents of Column ‘A’ on Sheet1 where Sheet1 has an autofilter – Column D is AutoFiltered to only select entries with a ‘Yes’ value. <o></o>
Sheet1 has a Header starting at row A5. Sheet1 has multiple columns of data included in the AutoFilter but I only want to select the filtered result of column A (minus the header) then paste it onto Sheet2 at A5 (the next free cell).
<o></o>
Is this possible? Many thanks in advance.<o></o>
<o> </o>
The macro works fine but copies all columns, I just want to copy column A.<o></o>
Sub CopyFilter()<o></o>
Dim rng As Range<o></o>
Dim rng2 As Range<o></o>
<o> </o>
With ActiveSheet.AutoFilter.Range<o></o>
On Error Resume Next<o></o>
Set rng2 = .Offset(1, 0).Resize(.Rows.Count - 1, 1) _<o></o>
.SpecialCells(xlCellTypeVisible)<o></o>
On Error GoTo 0<o></o>
<o> </o>
End With<o></o>
<o> </o>
If rng2 Is Nothing Then<o></o>
MsgBox "No data to copy"<o></o>
<o> </o>
Else<o></o>
Worksheets("Sheet2").Cells.Clear<o></o>
Set rng = ActiveSheet.AutoFilter.Range<o></o>
rng.Offset(1, 0).Resize(rng.Rows.Count - 1).Copy _<o></o>
Destination:=Worksheets("Sheet2").Range("A1")<o></o>