Copy cells in excel if cell above is null

Closed
Tara - Mar 14, 2012 at 09:42 PM
aquarelle Posts 7119 Registration date Saturday April 7, 2007 Status Moderator Last seen October 18, 2022 - Mar 15, 2012 at 05:32 AM
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

venkat1926 Posts 1864 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 810
Mar 15, 2012 at 02:19 AM
why not just sort column A
0
aquarelle Posts 7119 Registration date Saturday April 7, 2007 Status Moderator Last seen October 18, 2022 491
Mar 15, 2012 at 05:32 AM
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
0