Hi guys
Background:
Every year I receive a schedule of sports matches for the whole division, sorted by date.
(This could be anything eg soccer, but is actually bowls)
First thing I want to do is make a list of my team's matches.
VBA to the rescue.
I examine each line of the spreadsheet for my team's name, automatically, completes in seconds.
Send the routine to the central organiser so anyone can use it.
Everything is fine apart from one club: "City of Ely"
The If...Then routine below is activated when the targetclub variable = the interrogated cell.
Only, when City of Ely is selected it steps past directly to Next If.
Testing, capitalising "of" to "Of" works OK.
Can anyone explain what's happening please?
Background:
Every year I receive a schedule of sports matches for the whole division, sorted by date.
(This could be anything eg soccer, but is actually bowls)
First thing I want to do is make a list of my team's matches.
VBA to the rescue.
I examine each line of the spreadsheet for my team's name, automatically, completes in seconds.
Send the routine to the central organiser so anyone can use it.
Everything is fine apart from one club: "City of Ely"
The If...Then routine below is activated when the targetclub variable = the interrogated cell.
Only, when City of Ely is selected it steps past directly to Next If.
Testing, capitalising "of" to "Of" works OK.
Can anyone explain what's happening please?
Code:
If Range(RangeToSelect) = targetclub Then 'select a-c
RangeToSelect = "A" & (n + p) & ":C" & (n + p)
Range(RangeToSelect).Select
Selection.Cut 'paste into celladdress
Range(CellAddress).Select
ActiveSheet.Paste
End If