ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   detecting data in a range (https://www.excelbanter.com/excel-programming/344607-detecting-data-range.html)

cjsmith22

detecting data in a range
 

this will probably be completely obvious to some of you but being a bi
thick its got me stumped. i have a workbook which contains the result
and a table for the current premier football league.i have two range
in the worksheet (myresults and mytable). What needs to happen is th
table needs to update depending on the results that particular week.

the thing that i cant get my head around is this - "the macro should b
able to run successfully for any number of teams in the league and an
number of matches played. both of these should be detected from th
data. you may assume that the spelling of teams names in the result
section corresponds exactly to the spelling used in the league table
bearing in mind that a teams name can appear twice in a set of results


so how do i get my macro to detect, for example whats in cell b2 of th
myresults range, eg.tottenham, and get it to correspond with wher
tottenham may happen to be in the mytable range?

if that made the slightest bit of sense at all, thanks in advance

chri

+-------------------------------------------------------------------
|Filename: Table.zip
|Download: http://www.excelforum.com/attachment.php?postid=3989
+-------------------------------------------------------------------

--
cjsmith2
-----------------------------------------------------------------------
cjsmith22's Profile: http://www.excelforum.com/member.php...fo&userid=2852
View this thread: http://www.excelforum.com/showthread.php?threadid=48182


dysgraphia

detecting data in a range
 
Might help to see your code.
The VLOOKUP and MATCH may be useful.
In code something like:
myResult = Application.WorksheetFunction,VLookup("Tottenham", Range("Some
Range"),Some Number,False)....hard to be more specific ....perhaps
specify some concrete values where the data resides. Another way is to
set up a Do...Loop and cycle through your tables looking for the results
you want.
PS What the %^!!@?$! happened to ManU?

cjsmith22 wrote:
this will probably be completely obvious to some of you but being a bit
thick its got me stumped. i have a workbook which contains the results
and a table for the current premier football league.i have two ranges
in the worksheet (myresults and mytable). What needs to happen is the
table needs to update depending on the results that particular week.

the thing that i cant get my head around is this - "the macro should be
able to run successfully for any number of teams in the league and any
number of matches played. both of these should be detected from the
data. you may assume that the spelling of teams names in the results
section corresponds exactly to the spelling used in the league table -
bearing in mind that a teams name can appear twice in a set of results"


so how do i get my macro to detect, for example whats in cell b2 of the
myresults range, eg.tottenham, and get it to correspond with where
tottenham may happen to be in the mytable range?

if that made the slightest bit of sense at all, thanks in advance

chris


+-------------------------------------------------------------------+
|Filename: Table.zip |
|Download: http://www.excelforum.com/attachment.php?postid=3989 |
+-------------------------------------------------------------------+


cjsmith22[_2_]

detecting data in a range
 

cheers for the response dysgraphia - have attached what little i've done
so far which basically amounts to setting my ranges. I think what i need
to have is some sort of loop which first goes through my results range
to find the first team (say, arsenal), then checks if arsenal won, then
finds arsenal in the table range and adjusts its position accordingly,
then moves on to birmingham, then bolton etc.
what i cant understand is how you can then make it work for any set of
data, ie. the same macro working for a different set of teams and
different results. make any sense?

ps. utd have lost it mate - no midfield, *$%* at the back - all they've
got is ruud + rooney !


+-------------------------------------------------------------------+
|Filename: Copy of Table.zip |
|Download: http://www.excelforum.com/attachment.php?postid=3990 |
+-------------------------------------------------------------------+

--
cjsmith22
------------------------------------------------------------------------
cjsmith22's Profile: http://www.excelforum.com/member.php...o&userid=28528
View this thread: http://www.excelforum.com/showthread...hreadid=481826


cjsmith22[_4_]

detecting data in a range
 

dysgraphi

--
cjsmith2
-----------------------------------------------------------------------
cjsmith22's Profile: http://www.excelforum.com/member.php...fo&userid=2852
View this thread: http://www.excelforum.com/showthread.php?threadid=48182



All times are GMT +1. The time now is 05:32 PM.

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