Hi, This is my first post, I hope someone can help.
I have three columns of data and need to concat column 2 and 3 into column 4. Data Example:
_ A B C D E F G
1 a a a
2 a a a
3 a a a
4 a a
5 a a
6 a a
7 a
8 a
Where B and C are both present, I need them both to appear in D.
Where B is present but C is not, I need B to appear in D (it could attempt to add C, but I need B).
The current issue I have is I run this macro when C1 is selected and it will complete till C4 and stop as C4 is blank, D4-6 should get a value but don't.
I also have some data is A that is always present, right through to the last row, so If the loop worked on A:A until it reached a blank row (but combined B and C into D) that would be fine.
Current macro:
Sub ConcatColumns()
Do While ActiveCell <> "" 'Loops until the active cell is blank.
ActiveCell.Offset(0, 1).FormulaR1C1 = _
ActiveCell.Offset(0, -1) & "" & Chr(10) & "" & ActiveCell.Offset(0, 0)
ActiveCell.Offset(1, 0).Select
Loop
End Sub
I did try setting this line to contain a value that is not present, however the macro runs forever and a day down the sheet.
eg: Do While ActiveCell <> "XXXXXX"
Any help would be very much apreciated.
I have three columns of data and need to concat column 2 and 3 into column 4. Data Example:
_ A B C D E F G
1 a a a
2 a a a
3 a a a
4 a a
5 a a
6 a a
7 a
8 a
Where B and C are both present, I need them both to appear in D.
Where B is present but C is not, I need B to appear in D (it could attempt to add C, but I need B).
The current issue I have is I run this macro when C1 is selected and it will complete till C4 and stop as C4 is blank, D4-6 should get a value but don't.
I also have some data is A that is always present, right through to the last row, so If the loop worked on A:A until it reached a blank row (but combined B and C into D) that would be fine.
Current macro:
Sub ConcatColumns()
Do While ActiveCell <> "" 'Loops until the active cell is blank.
ActiveCell.Offset(0, 1).FormulaR1C1 = _
ActiveCell.Offset(0, -1) & "" & Chr(10) & "" & ActiveCell.Offset(0, 0)
ActiveCell.Offset(1, 0).Select
Loop
End Sub
I did try setting this line to contain a value that is not present, however the macro runs forever and a day down the sheet.
eg: Do While ActiveCell <> "XXXXXX"
Any help would be very much apreciated.