• Status: Solved
  • Priority: Medium
  • Security: Private
  • Views: 15
  • Last Modified:

VBA: Basic code to copy ranges based on criteria with AutoFilter method

What the basic code to copy a large range of data from Sheet1 (all columns) based on a value criteria in column 1 to Sheet2 using autofilter method. (copying with headers).

Thanks
0
Dmitriy Kritskiy
Asked:
Dmitriy Kritskiy
1 Solution
 
Saurabh Singh TeotiaCommented:
You can determine your range again post filter and then you can use something like this...

Dim rng As Range, lrow As Long
lrow = Cells(Cells.Rows.Count, "A").End(xlUp).Row
Set rng = Range("A1:D" & lrow)

rng.SpecialCells(xlCellTypeVisible).Copy

Open in new window


Saurabh...
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now