View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Ken Johnson Ken Johnson is offline
external usenet poster
 
Posts: 1,073
Default CONDENSE INFORMATION FROM ONE WORKSHEET TO ANOTHER

thaenn wrote:
On Worksheet #1:
In Column Y I have a list of codes
In Column Z, I have a list of weights, related directly to the codes (next
to them)
(not all codes will have a weight connected to it for each job)

In Worksheet #2:
I would like to create a summary only the codes that a weight related to it
(since there will always be more codes in worksheet #1, than I will ever fill
up for one job).

Thanks


Hi thaenn,

Try this...

Sub CodesUsed()
Const strDestination As String = "A1"
Dim lLastRow As Long
Application.ScreenUpdating = False
With Worksheets(1)
lLastRow = .Range("Z" & _
Range("Z:Z").Rows.Count).End(xlUp).Row
.Columns("Z:Z").AutoFilter _
Field:=1, Criteria1:="<"
.Range("Y2:Y" & lLastRow).Copy _
Worksheets(2).Range(strDestination)
.Columns("Z:Z").AutoFilter
End With
End Sub

As it is the 'used codes' will appear on sheet #2 starting at A1. If
you are wanting a different starting cell then simply edit the value of
the constant strDestination, that appears in the first line. For
example if you are wanting the list of 'used codes' to start from B5
then change...

Const strDestination As String = "A1" to Const strDestination As String
= "B5"

Ken Johnson