Hi all,
After a period of frustration and taking a break from a project I've bitten the bullet & revisited it.
I am trying to avoid writing a whole raft of routines to do the same thing. Any help appreciated.
What I need to do, is take a range of cells, copy them, paste them into another sheet. But I need to do it based on which group a referee wants on a score sheet.
Eg.
I have a sheet that looks like this...
Down the left column it goes all the way to 15 squads.
I've worked out that I can use a filter to select the squad I want based on the numbers in the left column.
I've played with this routine to do it.
Sub AutoFilter_in_Excel_Above_Below_Num()
Dim LR As Long
Range("B6", "L96").AutoFilter Field:=1, Criteria1:=">2", Operator:=xlAnd, Criteria2:="<3"
LR = Range("C" & Rows.Count).End(xlUp).Row
Range("C6:E" & LR).SpecialCells(xlCellTypeVisible).Select
Selection.Copy
Sheets("Score").Select
Range("AG6").Select
'--->>> Fix Selection.Paste - haven't finished this bit yet.
End Sub
At present I've not sorted out the paste side of it. My challenge was to work out the best way of getting just one squad from the 15.
What I need to do now is to set that routine up so that I can use an input box to get the squad number that someone wants to generate a score sheet for, and get that number from the user inot the filter criteria above.
Where the filter looks for >2 & <3 above, I need to generate the value in place of 2 from a question in an input box, call it X, and then filter between X and X+1.
I've never used an input box to get a variable, and then used it in a routine before.
Any pointers or suggestions welcome thanks (says he with fingers crossed...)
Thanks
Dave
After a period of frustration and taking a break from a project I've bitten the bullet & revisited it.
I am trying to avoid writing a whole raft of routines to do the same thing. Any help appreciated.
What I need to do, is take a range of cells, copy them, paste them into another sheet. But I need to do it based on which group a referee wants on a score sheet.
Eg.
I have a sheet that looks like this...
Down the left column it goes all the way to 15 squads.
I've worked out that I can use a filter to select the squad I want based on the numbers in the left column.
I've played with this routine to do it.
Sub AutoFilter_in_Excel_Above_Below_Num()
Dim LR As Long
Range("B6", "L96").AutoFilter Field:=1, Criteria1:=">2", Operator:=xlAnd, Criteria2:="<3"
LR = Range("C" & Rows.Count).End(xlUp).Row
Range("C6:E" & LR).SpecialCells(xlCellTypeVisible).Select
Selection.Copy
Sheets("Score").Select
Range("AG6").Select
'--->>> Fix Selection.Paste - haven't finished this bit yet.
End Sub
At present I've not sorted out the paste side of it. My challenge was to work out the best way of getting just one squad from the 15.
What I need to do now is to set that routine up so that I can use an input box to get the squad number that someone wants to generate a score sheet for, and get that number from the user inot the filter criteria above.
Where the filter looks for >2 & <3 above, I need to generate the value in place of 2 from a question in an input box, call it X, and then filter between X and X+1.
I've never used an input box to get a variable, and then used it in a routine before.
Any pointers or suggestions welcome thanks (says he with fingers crossed...)
Thanks
Dave