?
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
Medium Priority
?
432 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 2000 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

Office 365 Training for Admins - 7 Day Trial

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

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

My attempt to use PowerShell and other great resources found online to simplify the deployment of Office 365 ProPlus client components to any workstation that needs it, regardless of existing Office components that may be needing attention.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

752 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