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
422 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Highlighting cells in Excel 9 17
Freeze Panes Solution 6 28
Sum iF  based on a null cell 11 29
Excel range I cannot find 8 0
PaperPort has a feature called the "Send To Bar". It provides a convenient, drag-and-drop interface for using other installed software, such as Microsoft Office. However, this article shows that the latest Office 2016 apps (installed with an Office …
Recently Microsoft released a brand new function called CONCAT. It's supposed to replace its predecessor CONCATENATE. But how does it work? And what's new? In this article, we take a closer look at all of this - we even included an exercise file for…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

911 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