Solved

Copy data from above cell

Posted on 2014-03-18
4
155 Views
Last Modified: 2014-03-18
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
Comment
Question by:Jagwarman
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 51

Expert Comment

by:Rgonzo1971
ID: 39936253
Hi,

Until which end?  maybe not Row 1048576

Could you precise?

Regards
0
 

Author Comment

by:Jagwarman
ID: 39936255
Until row 500

tks
0
 
LVL 51

Accepted Solution

by:
Rgonzo1971 earned 500 total points
ID: 39936259
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
 

Author Closing Comment

by:Jagwarman
ID: 39936263
Thanks Rgonzo1971 you never fail me
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question