Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 09-23-2016, 11:08 PM
NoSparks NoSparks is offline Vlookup fill down blank cells in column Windows 7 64bit Vlookup fill down blank cells in column Office 2010 64bit
Excel Hobbyist
 
Join Date: Nov 2013
Location: British Columbia, Canada
Posts: 842
NoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of light
Default

OK, I think the Seizures Pending Acceptance.xlsx you've posted is what you have at the end of the macro running as you currently have it.


The formula has been inserted into E2 by the macro and the rows in the column down to row 61 appear to be empty.

If you look at this part of the macro you have
Code:
Columns("D:D").Select
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Columns("D:D").Select
    Selection.ColumnWidth = 15
    Range("D2").Select
    ActiveCell.FormulaR1C1 = "=MID(RC[-3],5,4)"
    Range("D2").Select
    Selection.AutoFill Destination:=Range("D2:D8000")
    Range("D2:D8000").Select
    Columns("D:D").Select
    Selection.Copy
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Columns("D:D").Select
    Range("D2").Activate
    Application.Run "enter_values"
    Columns("D:D").Select
    Columns("D:D").EntireColumn.AutoFit
You are inserting a new column D, making the original column D the new column E, and you never touch column E again until you insert the formula.
With the new column D, you insert a formula into D2, and autofill to D8000.
Then copy column D and paste it over itself as values.
Next you run the little "enter_values" sub which actually does the same .value=.value thing, again, on the same column.
I suspect the intention was for one of these operations to be on the old column D (the new E) and one on the new column D.


Any how, if I remove the formula from E2 and run this test macro on the sheet, things seem to be as they should be, give it a try
Code:
Sub Insert_Formula_and_Autofill()

    With Columns(5)
        .Value = .Value
    End With
    
    Range("E2").Select
    ActiveCell.FormulaR1C1 = _
        "=VLOOKUP(RC[-1],'[CBP Port and Other Agency Listing.xlsx]Combined'!C4:C5,2,FALSE)"
    Range("E2").Select
    Selection.AutoFill Destination:=Range("E2:E" & Cells(2, "E").End(xlDown).Row - 1)
    
End Sub
Reply With Quote
  #2  
Old 09-26-2016, 04:44 AM
mbesspiata mbesspiata is offline Vlookup fill down blank cells in column Windows 7 64bit Vlookup fill down blank cells in column Office 2010 64bit
Advanced Beginner
Vlookup fill down blank cells in column
 
Join Date: Mar 2011
Location: Virginia
Posts: 57
mbesspiata is on a distinguished road
Default Vlookup fill down blank cells in column

Thanks NoSparks that worked perfectly.
I really appreciate your help on this.

Mike
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto Fill only Blank Cells in a Column mbesspiata3 Excel Programming 1 09-22-2016 07:18 PM
Return Sum value of one column from cells not blank in another column zulugandalf Excel 3 08-14-2014 03:37 AM
Vlookup fill down blank cells in column How-TO format cells (FILL) by comparing cells zanat0s Excel 1 07-03-2012 04:27 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:23 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft