ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Need to find a value in a range and take action if its there (https://www.excelbanter.com/excel-programming/414274-need-find-value-range-take-action-if-its-there.html)

Geoff ML[_2_]

Need to find a value in a range and take action if its there
 
OK I have 1 range that is constantly changing with different goalies info.
This range has 3 columns, the first is the goalie number, the second is the
goalie position (always the letter G) and the third is the goalie name. I
have a second range that is a database of all goalies that have ever appeared
in the first list. It is also 3 columns. Essentially if in the first range
(FormattedGoalies) there is a new goalie that has never been seen before i
want it to add to the bottom of the second range called TeamPageGoalies.
There are always 2 goalies in FormattedGoalies, but these goalies change.

Goalie positions is simply set as the second column in GoaliesFormatted.
Thats how i find the next empty row in TeamPageGoalies by counting the number
of letters "G" in TeamPageGoalies then moving 2 down.


For Each Item In FormattedGoalies 'go's through each goalie in formatted
If Not TeamPageGoalies.Find(Item) Is Nothing Then 'adds the goalie to
teampage if he's not found
GoaliesRegistered = fxn.CountA(GoaliePositions) 'counts number of goalies on
teampage
For x = 0 To 2 'moves down the teampagegoalies range to add a new goalie,
then moves accross to add different info
TeamPageGoalies.Offset(0, x).Cells(2 + GoaliesRegistered) = Item.Offset(0, x)
Next x
End If
Next Item

Why won't this work? When i run it it often adds goalies to TeamPagePlayers
that are already on the list so i get multiple entries for the same person.
other times i Dont.


All times are GMT +1. The time now is 08:34 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com