Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Excel VBA Special Cells by Column

Posted on 2013-02-06
2
Medium Priority
?
502 Views
Last Modified: 2013-02-06
I need to fill in blank spaces in column C in a spreadsheet.  The loop should start from the bottom of column C and step up. If the next cell up is blank, I need to copy and paste from the cell below.  The problem I'm having is my code selects all the blank cells and copies from the cell below. I just want this copying to happen in column C.
What am I missing?

Sub Macro2()

Dim LastRow As Long
Dim i As Long
 
 Application.ScreenUpdating = False
 
    LastRow = Range("A" & Rows.Count).End(xlUp).Row
    
     For i = LastRow To 1 Step -1
       Columns("C:C").Select
            Selection.SpecialCells(xlCellTypeBlanks).Select
            Selection.FormulaR1C1 = "=R[+1]C"    
        Next i
Application.ScreenUpdating = True

End Sub

Open in new window

0
Comment
Question by:minamina6
[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 Comments
 
LVL 43

Accepted Solution

by:
Saqib Husain, Syed earned 2000 total points
ID: 38859777
Without looping try

Range("C1:C" & lastrow).specialcells(xlcelltypeblanks).formular1c1= "=R[+1]C"
0
 

Author Closing Comment

by:minamina6
ID: 38859807
That worked. Thanks!
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…

722 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