Sharid
Well-known Member
- Joined
- Apr 22, 2007
- Messages
- 1,066
- Office Version
- 2016
- Platform
- Windows
Hi
I need a code that will copy and paste data from column D to column B if column B is empty, the code will ignore any empty cells in column D and move to the next cell with data to copy over.
From this[TABLE="class: grid, width: 500, align: center"]
<tbody>[TR]
[TD="align: center"]A[/TD]
[TD="align: center"]B[/TD]
[TD="align: center"]C[/TD]
[TD="align: center"]D[/TD]
[/TR]
[TR]
[TD]JANE[/TD]
[TD][/TD]
[TD]JANE[/TD]
[TD]DOE[/TD]
[/TR]
[TR]
[TD]JOHN[/TD]
[TD]DOE[/TD]
[TD]JOHN[/TD]
[TD]DOE[/TD]
[/TR]
[TR]
[TD]JANE[/TD]
[TD][/TD]
[TD]JANE[/TD]
[TD]SMITH[/TD]
[/TR]
[TR]
[TD]JOHN[/TD]
[TD]SMITH[/TD]
[TD]JOHN[/TD]
[TD]SMITH[/TD]
[/TR]
[TR]
[TD]JAMES[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]JILL[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]JACK[/TD]
[TD][/TD]
[TD]JACK[/TD]
[TD]JONES[/TD]
[/TR]
</tbody>[/TABLE]
To This
[TABLE="class: grid, width: 500, align: center"]
<tbody>[TR]
[TD="align: center"]A[/TD]
[TD="align: center"]B[/TD]
[TD="align: center"]C[/TD]
[TD="align: center"]D[/TD]
[/TR]
[TR]
[TD]JANE[/TD]
[TD]DOE[/TD]
[TD]JANE[/TD]
[TD]DOE[/TD]
[/TR]
[TR]
[TD]JOHN[/TD]
[TD]DOE[/TD]
[TD]JOHN[/TD]
[TD]DOE[/TD]
[/TR]
[TR]
[TD]JANE[/TD]
[TD]SMITH[/TD]
[TD]JANE[/TD]
[TD]SMITH[/TD]
[/TR]
[TR]
[TD]JOHN[/TD]
[TD]SMITH[/TD]
[TD]JOHN[/TD]
[TD]SMITH[/TD]
[/TR]
[TR]
[TD]JAMES[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]JILL[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]JACK[/TD]
[TD]JONES[/TD]
[TD]JACK[/TD]
[TD]JONES[/TD]
[/TR]
</tbody>[/TABLE]
Hope this makes sense
I need a code that will copy and paste data from column D to column B if column B is empty, the code will ignore any empty cells in column D and move to the next cell with data to copy over.
From this[TABLE="class: grid, width: 500, align: center"]
<tbody>[TR]
[TD="align: center"]A[/TD]
[TD="align: center"]B[/TD]
[TD="align: center"]C[/TD]
[TD="align: center"]D[/TD]
[/TR]
[TR]
[TD]JANE[/TD]
[TD][/TD]
[TD]JANE[/TD]
[TD]DOE[/TD]
[/TR]
[TR]
[TD]JOHN[/TD]
[TD]DOE[/TD]
[TD]JOHN[/TD]
[TD]DOE[/TD]
[/TR]
[TR]
[TD]JANE[/TD]
[TD][/TD]
[TD]JANE[/TD]
[TD]SMITH[/TD]
[/TR]
[TR]
[TD]JOHN[/TD]
[TD]SMITH[/TD]
[TD]JOHN[/TD]
[TD]SMITH[/TD]
[/TR]
[TR]
[TD]JAMES[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]JILL[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]JACK[/TD]
[TD][/TD]
[TD]JACK[/TD]
[TD]JONES[/TD]
[/TR]
</tbody>[/TABLE]
To This
[TABLE="class: grid, width: 500, align: center"]
<tbody>[TR]
[TD="align: center"]A[/TD]
[TD="align: center"]B[/TD]
[TD="align: center"]C[/TD]
[TD="align: center"]D[/TD]
[/TR]
[TR]
[TD]JANE[/TD]
[TD]DOE[/TD]
[TD]JANE[/TD]
[TD]DOE[/TD]
[/TR]
[TR]
[TD]JOHN[/TD]
[TD]DOE[/TD]
[TD]JOHN[/TD]
[TD]DOE[/TD]
[/TR]
[TR]
[TD]JANE[/TD]
[TD]SMITH[/TD]
[TD]JANE[/TD]
[TD]SMITH[/TD]
[/TR]
[TR]
[TD]JOHN[/TD]
[TD]SMITH[/TD]
[TD]JOHN[/TD]
[TD]SMITH[/TD]
[/TR]
[TR]
[TD]JAMES[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]JILL[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]JACK[/TD]
[TD]JONES[/TD]
[TD]JACK[/TD]
[TD]JONES[/TD]
[/TR]
</tbody>[/TABLE]
Hope this makes sense