RockandGrohl
Well-known Member
- Joined
- Aug 1, 2018
- Messages
- 810
- Office Version
- 365
- Platform
- Windows
Hi all, got a quandry here.
Let's say I have a table like the below:
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]Paper[/TD]
[TD]Company[/TD]
[TD]Template[/TD]
[TD]Flag[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Aber Chronicle[/TD]
[TD]JG[/TD]
[TD]UK[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]Aber Chronicle[/TD]
[TD]JG[/TD]
[TD]UK[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]Ban Guard[/TD]
[TD]JG[/TD]
[TD]UK[/TD]
[TD]Y[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]Ban Guard[/TD]
[TD]JG[/TD]
[TD]UK[/TD]
[TD]Y[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]Biggle Chronicle[/TD]
[TD]JG[/TD]
[TD]UK[/TD]
[TD]Y[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]Biggle Chronicle[/TD]
[TD]JG[/TD]
[TD]UK[/TD]
[TD]Y[/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]Biggle Chronicle[/TD]
[TD]OM[/TD]
[TD]UK[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD]Biggle Chronicle[/TD]
[TD]JG[/TD]
[TD]UK[/TD]
[TD]Y[/TD]
[/TR]
[TR]
[TD]9[/TD]
[TD]Bolt News[/TD]
[TD]JG[/TD]
[TD]EU[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
The Y flag is assigned for the following criteria:
The end result is we have a "Y" flag per applicable line, however it appears multiple times per paper. What my intention is to do is automatically change just ONE line from a UK to an EU template. As per the above example, Biggle Chronicle has 4 lines, three of them are "Y" flags, but I only want one of them to change (And preferably the bottom one as it will be a larger template or later in the week)
I really can't figure out a way to do this, sensibly or otherwise, but it's gotta happen in VBA as my helper columns are getting out of control already.
Something that is annoying me is that "OM" lines can sometimes intersperse the JG lines, so I can't just look directly at the row below.
Maybe do an IF statement with a countif, so if total number of X tours with a Y is >1, then clear the activerow "Y" flag, drop down a row and count again?
Let's say I have a table like the below:
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]Paper[/TD]
[TD]Company[/TD]
[TD]Template[/TD]
[TD]Flag[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Aber Chronicle[/TD]
[TD]JG[/TD]
[TD]UK[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]Aber Chronicle[/TD]
[TD]JG[/TD]
[TD]UK[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]Ban Guard[/TD]
[TD]JG[/TD]
[TD]UK[/TD]
[TD]Y[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]Ban Guard[/TD]
[TD]JG[/TD]
[TD]UK[/TD]
[TD]Y[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]Biggle Chronicle[/TD]
[TD]JG[/TD]
[TD]UK[/TD]
[TD]Y[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]Biggle Chronicle[/TD]
[TD]JG[/TD]
[TD]UK[/TD]
[TD]Y[/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]Biggle Chronicle[/TD]
[TD]OM[/TD]
[TD]UK[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD]Biggle Chronicle[/TD]
[TD]JG[/TD]
[TD]UK[/TD]
[TD]Y[/TD]
[/TR]
[TR]
[TD]9[/TD]
[TD]Bolt News[/TD]
[TD]JG[/TD]
[TD]EU[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
The Y flag is assigned for the following criteria:
- Name appears >1
- Only advertising UK Template
- EU template applicable (not important here)
- Company is JG, not OM
The end result is we have a "Y" flag per applicable line, however it appears multiple times per paper. What my intention is to do is automatically change just ONE line from a UK to an EU template. As per the above example, Biggle Chronicle has 4 lines, three of them are "Y" flags, but I only want one of them to change (And preferably the bottom one as it will be a larger template or later in the week)
I really can't figure out a way to do this, sensibly or otherwise, but it's gotta happen in VBA as my helper columns are getting out of control already.
Something that is annoying me is that "OM" lines can sometimes intersperse the JG lines, so I can't just look directly at the row below.
Maybe do an IF statement with a countif, so if total number of X tours with a Y is >1, then clear the activerow "Y" flag, drop down a row and count again?