Copy cells in excel if cell above is null

[Closed]
Report
-
Posts
7098
Registration date
Saturday April 7, 2007
Status
Moderator
Last seen
June 10, 2021
-
Hello,

Can anyone help?

I need to run a script that will determine if a1 is blank, paste the information from a2 into the a1. If a1 is not null, it should do nothing. This needs to be run for every other cell. If a3 is null, paste information from a4. If a3 is not null, do nothing. And so on, and so on.

Any ideas?? Thanks in advance!

2 replies

Posts
1864
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
August 7, 2021
802
why not just sort column A
Posts
7098
Registration date
Saturday April 7, 2007
Status
Moderator
Last seen
June 10, 2021
487
Hi,

Try this macro :

Sub CompleteEmptyCell()

x = Range("A65536").End(xlUp).Row

For y = 1 To x
If Range("A" & y) = "" Then Range("A" & y) = Range("A" & y + 1)
Next

End Sub



Best regards