Solved

Copy data from above cell

Posted on 2014-03-18
4
150 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
  • 2
  • 2
4 Comments
 
LVL 48

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 48

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

INDEX and MATCH can be used to great effect to replace HLOOKUP and VLOOKUP as it does not have the limitation of needing the data to be sorted so that the reference value is in the first column or row. It also has the ability to perform a bi-directi…
Approximate matching with VLOOKUP and MATCH seems to me to be a greatly under-used technique, and one which is vital for getting good performance out of large lookups. Until recently I would always have advised using an exact match for simplicity an…
Viewers will learn the basics of slicers and timelines for both PivotTables and standard Excel tables in Excel 2013.
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …

762 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

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now