Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am attempting to transfer scoring data (based upon two criteria) from one
worksheet to another using VBA Find and FindNext. The problem I'm having is the Find Method only returns the first Run value. I'm fairly sure the problem is how I'm using FindNext. I've tried some different combinations but I can't seem to get it right. Any help would be greatly appreciated! Sample Source Worksheet: Position Year Name Runs 1B 2000 Player1 2 SS 2001 Player2 10 SS 2001 Player3 4 C 2002 Player4 28 the code below only returns the value of 10: Dim PAVTAry As Range, SrcChk1 As Range Dim FirstAddress As String Lr = LastRow(Sheets("3-yr Scoring")) + 1 Set PAVTAry = Sheets("3-yr Scoring").Range("A3:AH" & Lr) Sheets("PAVT Data").Range("F2").Select Do Set SrcChk1 = PAVTAry.Find(What:="SS", LookIn:=xlValues, _ LookAt:=xlWhole, SearchOrder:=xlByColumns, _ SearchDirection:=xlNext) If Not SrcChk1 Is Nothing Then FirstAddress = SrcChk1.Address Do Set SrcChk1 = PAVTAry.FindNext(SrcChk1) If SrcChk1.Offset(0, 1).Value = 2001 Then ActiveCell.Value = SrcChk1.Offset(0, 2).Value End If Loop While Not SrcChk1 Is Nothing And SrcChk1.Address < FirstAddress Else ActiveCell.Value = "0" End If ActiveCell.Offset(1, 0).Select Loop Until IsEmpty(ActiveCell.Offset(0, -5)) |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Findnext | Excel Discussion (Misc queries) | |||
FindNext | Excel Programming | |||
FindNext problem | Excel Programming | |||
FindNext problem when using PasteSpecial | Excel Programming | |||
problem with .FindNext | Excel Programming |