Hi ive got this macro (below) that i want to run to find the best score over lots of events.
at the moment its only for one row of the sheet but i want to run it on multiple rows is there a way i can do this without having to copy out the same macro
20 times and change the the range?
I also want to run the macro on 150 sheets how would i loop it through these?
Some of the sheets have more rows data than others so how would i write an IF saying is the is data in the A cell above the row. (so if cell A1 has data then macro on B2:R2)
the last thing is that if there is an empty cell in the range it ranks that cell as being a high score. is there any way that if it finds an empty cell it can return the words "EMPTY" in the results or run another macro befor to find any empty cells in the ranges for the workbook?
heres the macro ive writen so far
heres an googledocs example of the type of data i want to run the macro on
https://spreadsheets.google.com/spr...hvdEFCTW9jd1hOYzZ1cjdwUEZ1TXZMS1E&output=html
any help will be amazing ive been pulling my hair out over this for weeks !
cheers
Sam
at the moment its only for one row of the sheet but i want to run it on multiple rows is there a way i can do this without having to copy out the same macro
20 times and change the the range?
I also want to run the macro on 150 sheets how would i loop it through these?
Some of the sheets have more rows data than others so how would i write an IF saying is the is data in the A cell above the row. (so if cell A1 has data then macro on B2:R2)
the last thing is that if there is an empty cell in the range it ranks that cell as being a high score. is there any way that if it finds an empty cell it can return the words "EMPTY" in the results or run another macro befor to find any empty cells in the ranges for the workbook?
heres the macro ive writen so far
Code:
Sub SportsRank_1()
Range("X3").Value = "Place"
Range("Y3").Value = "Name(s)"
Range("X4").Value = "1st"
Range("Y4:Y100").Value = ""
On Error Resume Next
For Each cell In Range("B4:R4")
cell.Offset(1, 0).Value = Application.Rank(cell.Value, Range("B4:R4"), 0)
Next
For i = 1 To 10
For Each cell In Range("B5:R5")
If cell.Value = i Then
setPlace = setPlace & cell.Offset(-2, 0).Value & ", "
End If
Next cell
Range("Y" & Rows.Count).End(xlUp).Offset(1, 0).Value = Left(setPlace, Len(setPlace) - 2)
setPlace = ""
Next i
Range("B5:R5").ClearContents
Range("Y5:Y100").ClearContents
End Sub
heres an googledocs example of the type of data i want to run the macro on
https://spreadsheets.google.com/spr...hvdEFCTW9jd1hOYzZ1cjdwUEZ1TXZMS1E&output=html
any help will be amazing ive been pulling my hair out over this for weeks !
cheers
Sam