Solved

If cell below me blank, copy and paste my value to it. If not blank and not equal to me, repeat with new value.  36,000 rows, 1 column.

Posted on 2011-03-04
3
421 Views
Last Modified: 2012-05-11
I have a spreadsheet with 36,000 rows of data. I am focusing on one column, Column A.

The column begins with Value 1 in the first row, followed by some blank rows, and then a row with Value 1 again.
As you continue down the column, there are more blank rows and different values in the non-blank rows (Value 2, Value 3, etc.).
I need some automated way to start in cell A1 and evaluate so that "If cell below me is blank, paste me there. If cell below me is not blank and not equal to me, paste different-valued-cell to cell below it, if that cell is blank."
In other words, the blank cells need to have the value of the most-recent non-blank cell, until a new value is reached. Then, the new value needs to be pasted in the blank rows below that value, until a new value, etc.

Please see the attached files to see what I am going for. There is a .xls file (for compatibility. I am using Excel 2007.) as well as a .PNG image (both of the same thing).

Your help would be greatly appreciated, as I have other sheets where I need to do the same thing. Thank you in advance.

IfThenRules-ExampleSheet.xls
IfThenExample.png
0
Comment
Question by:nicholasjwolf
  • 2
3 Comments
 
LVL 39

Accepted Solution

by:
nutsch earned 500 total points
ID: 35039074
Here is a code that will do this for all selected sheets

Thomas

Sub asdgasdg()
Dim sht As Worksheet

For Each sht In ActiveWindow.SelectedSheets
    With ActiveSheet.UsedRange.Resize(ActiveSheet.UsedRange.Rows.Count + 10).Columns(1)
        .SpecialCells(xlCellTypeBlanks).FormulaR1C1 = "=R[-1]C"
        .Copy
        .PasteSpecial Paste:=xlPasteValues
    End With
Next

End Sub

Open in new window

0
 

Author Comment

by:nicholasjwolf
ID: 35039172
nutsch,
      I love you!! This is exactly what I needed!
0
 
LVL 39

Expert Comment

by:nutsch
ID: 35039290
Glad to help, thanks for the grade.

Thomas
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

706 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

16 Experts available now in Live!

Get 1:1 Help Now