View Single Post
  #6   Report Post  
gerry405 gerry405 is offline
Junior Member
 
Posts: 11
Default

thanks Dave,


I have tried the populating code as you suggested, it works fine for one column(only), but I can't adjust it to do more than one column, partly because I don't understand what your code is doing, more so at the part below

ie

.Range("D2").AutoFill _
Destination:=.Range("d2:d" & LastRow)
what does "d2:d2 stand for

When I run my macro I would like to populate more than one column so I've tried to adjust to no avail, I thought I could do the following with your code:

Option Explicit
Sub testme02()

Dim LastRow As Long
Dim wks As Worksheet

Set wks = ActiveSheet
With wks
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row

.Range("D2").AutoFill _
Destination:=.Range("d2:d" & LastRow)

.Range("F2").AutoFill _
Destination:=.Range("d2:d" & LastRow)

.Range("L2").AutoFill _
Destination:=.Range("d2:d" & LastRow)

End With

End Sub

But this does not work, I expect you'll know why, but to me it's double dutch
Quote:
Originally Posted by Dave Peterson
And next time you do a custom filter, you'll notice that you get 2 criteria per
field--not 3.

I've used a helper column that contains a formula that evaluates to true/false
and then filtered on that.



You may want to learn more about Data|Advanced filter, too. You can set up a
criteria range that allows you to specifiy lots of criteria.

Debra Dalgleish has some get started tips:
http://contextures.com/xladvfilter01.html



gerry405 wrote:

Dave,

Thanks for your input, I still have the problem where I am looking for
more than one thing in a column and if it finds these I need to display
these only, I tried the below code as you suggested but it still does
not work.

I need to do a "multiple or" for more than just two criteria in a
specific column

Sub code()
With Range("a1:Z999")
AutoFilter Field:=15, Criteria1:="9"
AutoFilter Field:=15, Criteria1:="3"
AutoFilter Field:=15, Criteria1:="5"
End With
End Sub

--
gerry405
------------------------------------------------------------------------
gerry405's Profile: http://www.excelforum.com/member.php...o&userid=27939
View this thread: http://www.excelforum.com/showthread...hreadid=474278


--

Dave Peterson