Hi everyone,
I have some very basic scripting skills but they don't yet translate well to VBA so would very much appreciate the benefit of your knowledge.
I have a spreadsheet with over 6k rows, each with over 30 columns.
My focus is in 2 columns. ColumnA is formatted as General, ColumnB as Number.
[TABLE="class: grid, width: 425"]
<tbody>[TR]
[TD]ColumnA[/TD]
[TD]ColumnB[/TD]
[/TR]
[TR]
[TD]05255088-0f15-48f1-a65e-affb6d583d35[/TD]
[TD="align: right"]1373064224475[/TD]
[/TR]
[TR]
[TD]05255088-0f15-48f1-a65e-affb6d583d35[/TD]
[TD="align: right"]1373064224475[/TD]
[/TR]
[TR]
[TD]05384219-f4ad-44de-9efc-d6526ad16941[/TD]
[TD="align: right"]1373064223701[/TD]
[/TR]
[TR]
[TD]05384219-f4ad-44de-9efc-d6526ad16941[/TD]
[TD="align: right"]1373064223701[/TD]
[/TR]
[TR]
[TD]0539a867-1272-462d-ab34-fe3af4d0aa8b[/TD]
[TD="align: right"]1373064221218[/TD]
[/TR]
[TR]
[TD]0539a867-1272-462d-ab34-fe3af4d0aa8b[/TD]
[TD="align: right"]1373064221218[/TD]
[/TR]
[TR]
[TD]0539a867-1272-462d-ab34-fe3af4d0aa8b[/TD]
[TD="align: right"]1373064221218[/TD]
[/TR]
[TR]
[TD]0539a867-1272-462d-ab34-fe3af4d0aa8b[/TD]
[TD="align: right"]1373064221218[/TD]
[/TR]
</tbody>[/TABLE]
I need your assistance with VBA code that will Fill the cell in ColumnB if it changes within the same ColumnA data.
So the output would end up like this. (Although the cell would be filled, not the text turned red)
[TABLE="class: grid, width: 425"]
<tbody>[TR]
[TD]05255088-0f15-48f1-a65e-affb6d583d35[/TD]
[TD="align: right"]1373064224475[/TD]
[/TR]
[TR]
[TD]05255088-0f15-48f1-a65e-affb6d583d35[/TD]
[TD="align: right"]1373064224475[/TD]
[/TR]
[TR]
[TD]05384219-f4ad-44de-9efc-d6526ad16941[/TD]
[TD="align: right"]1373064223701[/TD]
[/TR]
[TR]
[TD]05384219-f4ad-44de-9efc-d6526ad16941[/TD]
[TD="align: right"]12345[/TD]
[/TR]
[TR]
[TD]0539a867-1272-462d-ab34-fe3af4d0aa8b[/TD]
[TD="align: right"]1373064221218[/TD]
[/TR]
[TR]
[TD]0539a867-1272-462d-ab34-fe3af4d0aa8b[/TD]
[TD="align: right"]1373064221218[/TD]
[/TR]
[TR]
[TD]0539a867-1272-462d-ab34-fe3af4d0aa8b[/TD]
[TD="align: right"]9876543[/TD]
[/TR]
[TR]
[TD]0539a867-1272-462d-ab34-fe3af4d0aa8b[/TD]
[TD="align: right"]9876543[/TD]
[/TR]
</tbody>[/TABLE]
So it's pretty basic. If we simply remember the first ColumnA and ColumnB data, go to the next row, if ColumnA is the same, then ColumnB should be the same. If it's not, then fill with red, go to the next row, repeat. if ColumnA changes, remember the new pair, go to the next row and compare again.
I've thought about this from a scripting perspective, and imagine that something like this would do the job:
I've gotten a start on changing the script to VBA, but am now strugging. Would you please take a look and give me your thoughts and code suggestions?
Thank you very much!
I have some very basic scripting skills but they don't yet translate well to VBA so would very much appreciate the benefit of your knowledge.
I have a spreadsheet with over 6k rows, each with over 30 columns.
My focus is in 2 columns. ColumnA is formatted as General, ColumnB as Number.
[TABLE="class: grid, width: 425"]
<tbody>[TR]
[TD]ColumnA[/TD]
[TD]ColumnB[/TD]
[/TR]
[TR]
[TD]05255088-0f15-48f1-a65e-affb6d583d35[/TD]
[TD="align: right"]1373064224475[/TD]
[/TR]
[TR]
[TD]05255088-0f15-48f1-a65e-affb6d583d35[/TD]
[TD="align: right"]1373064224475[/TD]
[/TR]
[TR]
[TD]05384219-f4ad-44de-9efc-d6526ad16941[/TD]
[TD="align: right"]1373064223701[/TD]
[/TR]
[TR]
[TD]05384219-f4ad-44de-9efc-d6526ad16941[/TD]
[TD="align: right"]1373064223701[/TD]
[/TR]
[TR]
[TD]0539a867-1272-462d-ab34-fe3af4d0aa8b[/TD]
[TD="align: right"]1373064221218[/TD]
[/TR]
[TR]
[TD]0539a867-1272-462d-ab34-fe3af4d0aa8b[/TD]
[TD="align: right"]1373064221218[/TD]
[/TR]
[TR]
[TD]0539a867-1272-462d-ab34-fe3af4d0aa8b[/TD]
[TD="align: right"]1373064221218[/TD]
[/TR]
[TR]
[TD]0539a867-1272-462d-ab34-fe3af4d0aa8b[/TD]
[TD="align: right"]1373064221218[/TD]
[/TR]
</tbody>[/TABLE]
I need your assistance with VBA code that will Fill the cell in ColumnB if it changes within the same ColumnA data.
So the output would end up like this. (Although the cell would be filled, not the text turned red)
[TABLE="class: grid, width: 425"]
<tbody>[TR]
[TD]05255088-0f15-48f1-a65e-affb6d583d35[/TD]
[TD="align: right"]1373064224475[/TD]
[/TR]
[TR]
[TD]05255088-0f15-48f1-a65e-affb6d583d35[/TD]
[TD="align: right"]1373064224475[/TD]
[/TR]
[TR]
[TD]05384219-f4ad-44de-9efc-d6526ad16941[/TD]
[TD="align: right"]1373064223701[/TD]
[/TR]
[TR]
[TD]05384219-f4ad-44de-9efc-d6526ad16941[/TD]
[TD="align: right"]12345[/TD]
[/TR]
[TR]
[TD]0539a867-1272-462d-ab34-fe3af4d0aa8b[/TD]
[TD="align: right"]1373064221218[/TD]
[/TR]
[TR]
[TD]0539a867-1272-462d-ab34-fe3af4d0aa8b[/TD]
[TD="align: right"]1373064221218[/TD]
[/TR]
[TR]
[TD]0539a867-1272-462d-ab34-fe3af4d0aa8b[/TD]
[TD="align: right"]9876543[/TD]
[/TR]
[TR]
[TD]0539a867-1272-462d-ab34-fe3af4d0aa8b[/TD]
[TD="align: right"]9876543[/TD]
[/TR]
</tbody>[/TABLE]
So it's pretty basic. If we simply remember the first ColumnA and ColumnB data, go to the next row, if ColumnA is the same, then ColumnB should be the same. If it's not, then fill with red, go to the next row, repeat. if ColumnA changes, remember the new pair, go to the next row and compare again.
I've thought about this from a scripting perspective, and imagine that something like this would do the job:
Code:
sub FindBadTermID ()
Dim row As Integer
Dim dataA as string, dataB as string
Set row = 2
newColumnALoop
Set dataA = A(row), dataB=B(row) # Get the first pair in a new ColumnA group
Set row=row+1
testColunBLoop
if A(row) = Blank, end
if A(row) != dataA, goto newColumnALoop # If it's a new ColumnA group, go back and get first pair
if B(row) != dataB, fill B(row)=red # If ColumnB is different that ColumnB of the first pair, make the cell red
Set row=row+1
goto testColumnBLoop
End Sub
I've gotten a start on changing the script to VBA, but am now strugging. Would you please take a look and give me your thoughts and code suggestions?
Thank you very much!