Basically I am working with two columns and I want my code to:
1) Check column1 so it knows which row to stop on first (the end), then
2) Change the name in column1 on the condition that there is nothing in the same row in column2 (because we are filling the column2 in with the changed name), then
3) Then change the next name in column1 differently on the condition that there is nothing in the same row in column2 (because we are filling the column2 in with the next changed name), then
4) Loop back to the first name change method.
[TABLE="class: outer_border, width: 50"]
<tbody>[TR]
[TD]Name#1
[/TD]
[TD]NameChanged#1
[/TD]
[/TR]
[TR]
[TD]Name#2
[/TD]
[TD]NameChanged#2
[/TD]
[/TR]
</tbody>[/TABLE]
----------------------------------------------------------------PART 1--------
----------------------------------------------------------------PART 2--------
---------------------------------------------------------------------------------
I can get my code to work but only the first part.
PROBLEM #1 :
As soon as I add the second piece it complains about multiple of the same "For" statements or variables or something... I can't seem to put these pieces together correctly, I've tried a bunch of things like "Exit For" etc... but I'm stuck.PROBLEM #2 :
Also I am not sure how to get it to loop back to the first part to do that one again either...Any help is appreciated!!!
Thanks for your help!
1) Check column1 so it knows which row to stop on first (the end), then
2) Change the name in column1 on the condition that there is nothing in the same row in column2 (because we are filling the column2 in with the changed name), then
3) Then change the next name in column1 differently on the condition that there is nothing in the same row in column2 (because we are filling the column2 in with the next changed name), then
4) Loop back to the first name change method.
[TABLE="class: outer_border, width: 50"]
<tbody>[TR]
[TD]Name#1
[/TD]
[TD]NameChanged#1
[/TD]
[/TR]
[TR]
[TD]Name#2
[/TD]
[TD]NameChanged#2
[/TD]
[/TR]
</tbody>[/TABLE]
----------------------------------------------------------------PART 1--------
Code:
x_endrow = Range("A" & Rows.Count).End(xlUp).Row
For i = 2 To x_endrow
If IsEmpty(Cells(i, 2)) Then
...do something here to change the name
End If
Code:
For i = 2 To x_endrow
If IsEmpty(Cells(i, 2)) Then
...do something different here to change the name
End If
I can get my code to work but only the first part.
PROBLEM #1 :
As soon as I add the second piece it complains about multiple of the same "For" statements or variables or something... I can't seem to put these pieces together correctly, I've tried a bunch of things like "Exit For" etc... but I'm stuck.PROBLEM #2 :
Also I am not sure how to get it to loop back to the first part to do that one again either...Any help is appreciated!!!
Thanks for your help!