• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 161
  • Last Modified:

Copy data from above cell

I found the below code on EE posted by: zorvek (Kevin Jones) but it stops after the first occurence. I need this to loop to the end. Can someone let me know what is needed to make the macro copy every cell that is blank with the same details as the cell above until the end.



Sub SelectAccount()

     If Len(Selection.Value) = 0 Then
       Selection.Value = Selection.Offset(-1).Value
   Else
       Selection.Offset(1).Select
   End If


End Sub


Thanks
0
Jagwarman
Asked:
Jagwarman
  • 2
  • 2
1 Solution
 
Rgonzo1971Commented:
Hi,

Until which end?  maybe not Row 1048576

Could you precise?

Regards
0
 
JagwarmanAuthor Commented:
Until row 500

tks
0
 
Rgonzo1971Commented:
Hi,

pls try

Do
     If Len(Selection.Value) = 0 Then
       Selection.Value = Selection.Offset(-1).Value
   Else
       Selection.Offset(1).Select
   End If
Loop Until Selection.Row = 501

Open in new window

Regards
0
 
JagwarmanAuthor Commented:
Thanks Rgonzo1971 you never fail me
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now