ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy Cell from Row Above (https://www.excelbanter.com/excel-programming/339798-copy-cell-row-above.html)

narutard[_24_]

Copy Cell from Row Above
 

s there a command that will copy the CELL from the row above it -- i.e.
copy A1 to copy A2
.. I'm thinking of selection.filldown but i don't know how to adjust the
fields so that it only looks 1 row above it

i'm planing on using this in a loop for a selection that will scan a
series of rows and if there is a certain criteria i want it to copy the
cell from the row above

THANKS

Sub fill_in_the_blanks()

Application.ScreenUpdating = False
Columns("A:A").Select
For Each cell In Selection
If cell = "" Then
*copy the cell above it and paste the cell from above to here*
End If
Next cell
Application.ScreenUpdating = True

End Sub


--
narutard
------------------------------------------------------------------------
narutard's Profile: http://www.excelforum.com/member.php...o&userid=25111
View this thread: http://www.excelforum.com/showthread...hreadid=466778


Mike Punko

Copy Cell from Row Above
 
Why not just use teh IF Function?

A3=IF(A20,A2,A1)

A20 This is you rule for a True or False
A2 Is returned if True
A1 Is returned if False

A B
1 1 2
2 0 2
3 1



"narutard" wrote:


s there a command that will copy the CELL from the row above it -- i.e.
copy A1 to copy A2
. I'm thinking of selection.filldown but i don't know how to adjust the
fields so that it only looks 1 row above it

i'm planing on using this in a loop for a selection that will scan a
series of rows and if there is a certain criteria i want it to copy the
cell from the row above

THANKS

Sub fill_in_the_blanks()

Application.ScreenUpdating = False
Columns("A:A").Select
For Each cell In Selection
If cell = "" Then
*copy the cell above it and paste the cell from above to here*
End If
Next cell
Application.ScreenUpdating = True

End Sub


--
narutard
------------------------------------------------------------------------
narutard's Profile: http://www.excelforum.com/member.php...o&userid=25111
View this thread: http://www.excelforum.com/showthread...hreadid=466778




All times are GMT +1. The time now is 07:48 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com