Find Variable

D

daisy2008

Hello,

I really need help with this one. I need to find a variable that will be in
D11 sheet1 find it in sheet2 column D copy all the rows and paste it in
sheet3.

Ex:

December in the value in cell D11

find December in column d copy all of the rows

Number Name order date Month received order number
101085 test 11/14/08 December 12
102086 joe 11/20/08 December 15
205684 Ann 10/25/08 November 9
100852 Dave 11/2/08 December 11

then paste the entire rows to sheet3 A3

Number Name order date Month received order number
101085 test 11/14/08 December 12
102086 joe 11/20/08 December 15
100852 Dave 11/2/08 December 11


Can this be done?

Thanks Daisy :)
 
D

Don Guillett

Data>filter>autofilter>filter by Dec>copy/paste to destination. Record a
macro if desired & clean it up.
 
G

Gary''s Student

Use AutoFilter.

Switch-on AutoFilter on column D and select December
Copy the visible rows and paste them to Sheet3

If you want a macro to do this, just use the Recorder.
 
D

daisy2008

so I would have to do that every time I want to change the month? and for
those using this worksheet that don't know excel that well? I was hoping for
something more simple I thought there would be an easier way just to state in
a cell what month, click a search botton and it would bring up the report.

Is there no easier way?

Daisy
 
D

Don Guillett

The macro can be taught to do just that. It can even ask for the month
instead of putting in a cell.
 
D

daisy2008

Ok I did as you said but it just keeps doing it for the same month I can't
change it. Do I have to record one of those for each month and just have a
whole bunch of text boxes to click on for each month?
 
D

daisy2008

Ok I found this one but it has a fixed variable mine will not and i will need
it to work from sheet3 with the value in D11

Sub Copy_with_Autofilter()
Dim FilterValue As String
Dim rng As Range
Dim rng2 As Range

Set rng = Range("A:A")
FilterValue = "test*"
rng.AutoFilter Field:=1, Criteria1:=FilterValue
With ActiveSheet.AutoFilter.Range
On Error Resume Next
Set rng2 = .Offset(1, 0).Resize(.Rows.Count - 1, 1) _
.SpecialCells(xlCellTypeVisible)
On Error GoTo 0
If Not rng2 Is Nothing Then
rng2.EntireRow.Copy Sheets("Sheet2").Range("A1")
End If
End With
ActiveSheet.AutoFilterMode = False
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top