+ Reply to Thread
Results 1 to 4 of 4

VBA macro to fill in blanks with value from another column

  1. #1
    Registered User
    Join Date
    02-27-2020
    Location
    Southampton, England
    MS-Off Ver
    Office 365
    Posts
    12

    Question VBA macro to fill in blanks with value from another column

    Hello everyone

    I am trying to use a macro to fill in blanks in column S, using values from column O using the below code but it isn’t quite working. Is anyone able to help? The formula below nearly works, but it only seems to be pulling the value from cell O2 and not moving down in line with each blank.

    Sub FillBlankYear()

    On Error Resume Next

    With Columns("S").SpecialCells(xlCellTypeBlanks)
    .FormulaR1C1 = "=RC[-1]"
    .Value = .Offset(0, -4).Value
    End With

    End Sub

    Thanks all, much appreciated.

    Ben
    Attached Images Attached Images

  2. #2
    Registered User
    Join Date
    02-23-2020
    Location
    France
    MS-Off Ver
    2019
    Posts
    44

    Re: VBA macro to fill in blanks with value from another column

    Please Login or Register  to view this content.
    The errors were:
    • you put a formula that refers to column R (-1 from current position)
    • you override that formula with a value that is correct

    Cheers,
    --
    LR

  3. #3
    Registered User
    Join Date
    02-27-2020
    Location
    Southampton, England
    MS-Off Ver
    Office 365
    Posts
    12

    Re: VBA macro to fill in blanks with value from another column

    Thank you so much! This works now. How do I buy you a beer?!

  4. #4
    Registered User
    Join Date
    02-23-2020
    Location
    France
    MS-Off Ver
    2019
    Posts
    44

    Re: VBA macro to fill in blanks with value from another column

    Add reputation !

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] How to find last row with a value in column A with blanks and fill
    By gmr4evr1 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-14-2017, 06:18 PM
  2. How to fill blanks between column and row
    By FloydTx in forum Excel General
    Replies: 3
    Last Post: 06-08-2017, 04:49 PM
  3. Fill in blanks with a value using a Macro
    By rz6657 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-10-2017, 10:14 PM
  4. [SOLVED] Code to fill in blanks between entries in column
    By phbryan in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-23-2015, 09:35 AM
  5. Need to fill blanks in a column
    By bclucas55 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-16-2014, 11:27 AM
  6. [SOLVED] Macro to fill in missing blanks with data in a column
    By robertguy in forum Excel General
    Replies: 6
    Last Post: 10-19-2012, 02:49 AM
  7. Fill blanks in Column
    By LongArm in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 03-20-2010, 11:15 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1