+ Reply to Thread
Results 1 to 6 of 6

Filling blank cells based on neighbouring column

Hybrid View

  1. #1
    Registered User
    Join Date
    03-03-2009
    Location
    Budapest
    MS-Off Ver
    Excel 2007
    Posts
    44

    Re: Filling blank cells based on neighbouring column

    Hi!

    This works, but the problem is that it fills in almost 40 cells in column E while I would need it to fill only 2 cells
    I am attaching the file, so you can see what I am talking about
    (the value in L1 should be pasted into the yellow cells, and it also may happen that there are more cells to be filled in ,depending on the number of lines already present in columns A:D)

    Many thanks in advance
    Attached Files Attached Files

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Filling blank cells based on neighbouring column

    I had a quick look at your code... if you're looking to copy the filtered range only perhaps:

    Sub Button1_Click()
    Dim rngPaste As Range
    With ThisWorkbook.Sheets("Sheet1")
        Set rngPaste = .Cells(.Rows.Count,"A").End(xlUp).Offset(1)
    End With
    Workbooks.Open "C:\Users\u565873\Desktop\TEST source.xlsx"
    With ActiveWorkbook.Sheets("Sheet1").Range("$A$7:$D$11")
        .AutoFilter Field:=3, Criteria1:="<>"
        .SpecialCells(xlCellTypeVisible).Offset(1).Copy rngPaste
        .AutoFilter
    End With
    ActiveWorkbook.Close False
    Set rngPaste = Nothing
    With ThisWorkbook.Sheets("Sheet1")
        .Range(.Cells(2, "A"), .Cells(.Rows.Count, "A").End(xlUp)).Offset(, 4).SpecialCells(xlCellTypeBlanks).Value = .Range("L1").Value
    End With
    End Sub
    Last edited by DonkeyOte; 11-02-2009 at 06:02 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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