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
431 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
[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
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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.

Question has a verified solution.

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

I was prompted to write this article after the recent World-Wide Ransomware outbreak. For years now, System Administrators around the world have used the excuse of "Waiting a Bit" before applying Security Patch Updates. This type of reasoning to me …
This article describes a serious pitfall that can happen when deleting shapes using VBA.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.
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.

691 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