Hello
Hopefully someone will be able to help
I have a worksheet and i need some <acronym title="visual basic for applications" style="border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: dotted; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(0, 0, 0); border-left-color: initial; border-image: initial; font-variant-numeric: normal; font-variant-east-asian: normal; cursor: help; color: rgb(51, 51, 51); background-color: rgb(250, 250, 250);">vba</acronym> code that will do the following:
If cell value in column B = X
And the next cell value in column B = Y or Z,
then replace Y with XY and Z with XZ
And
If cell value in column B = XY or XZ
And the next cell value in column B = X or Z,
then replace Y with XY and Z with XZ
otherwise do nothing
Example:
[TABLE="class: grid, width: 150, align: left"]
<tbody>[TR]
[TD][/TD]
[TD]z[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]y[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]x[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]y[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]y[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]x[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]y[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]z[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]y[/TD]
[/TR]
</tbody>[/TABLE]
to be
[TABLE="class: grid, width: 150, align: left"]
<tbody>[TR]
[TD][/TD]
[TD]z[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]y[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]x[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]xy[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]xy[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]x[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]xy[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]xz[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]y[/TD]
[/TR]
</tbody>[/TABLE]
Thank you.
Hopefully someone will be able to help
I have a worksheet and i need some <acronym title="visual basic for applications" style="border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: dotted; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(0, 0, 0); border-left-color: initial; border-image: initial; font-variant-numeric: normal; font-variant-east-asian: normal; cursor: help; color: rgb(51, 51, 51); background-color: rgb(250, 250, 250);">vba</acronym> code that will do the following:
If cell value in column B = X
And the next cell value in column B = Y or Z,
then replace Y with XY and Z with XZ
And
If cell value in column B = XY or XZ
And the next cell value in column B = X or Z,
then replace Y with XY and Z with XZ
otherwise do nothing
Example:
[TABLE="class: grid, width: 150, align: left"]
<tbody>[TR]
[TD][/TD]
[TD]z[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]y[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]x[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]y[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]y[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]x[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]y[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]z[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]y[/TD]
[/TR]
</tbody>[/TABLE]
to be
[TABLE="class: grid, width: 150, align: left"]
<tbody>[TR]
[TD][/TD]
[TD]z[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]y[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]x[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]xy[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]xy[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]x[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]xy[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]xz[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]y[/TD]
[/TR]
</tbody>[/TABLE]
Thank you.