# Thread: FILL IF IS BLANK (2000 sr 1)

1. ## FILL IF IS BLANK (2000 sr 1)

in this wbook is present an hide sheet DB AGENZIE.
My problem, with a macro:
If in the column L not is present the same value in the colum K copy the value in the cells of column L and fill the cells blank

2. ## Re: FILL IF IS BLANK (2000 sr 1)

Can you give a specific example? There are 65477 blank cells in column L.

3. ## Re: FILL IF IS BLANK (2000 sr 1)

Does something like this help

Option Explicit

Private Sub FillDates()

Dim Source as Range
Dim oCell as Range

Set Source = Range("L2:L100")
For each oCell in Source
If Not IsBlank(oCell) And oCell<>oCell.Offset(-1,0) then
oCell.Offset(-1,0) =oCell
End If
Next

End Sub

4. ## Re: FILL IF IS BLANK (2000 sr 1)

In effect copy the same value present in K if in L not is prsent...
In this case from K60 in L60, k61 in L61 ecc....
Do until the macro find in column K a blank cell...
During the macro no open the sheet...

5. ## Re: FILL IF IS BLANK (2000 sr 1)

Here is a variation on Paul's code:

Private Sub FillDates()
Dim wks As Worksheet
Dim oCell As Range

Set wks = Worksheets("DB_AGENZIE")

For Each oCell In wks.Range(wks.Range("K2"), wks.Range("K65536").End(xlUp))
If oCell.Offset(0, 1) = "" Then
oCell.Offset(0, 1) = oCell
End If
Next

Set wks = Nothing
Set oCell = Nothing
End Sub

6. ## Re: FILL IF IS BLANK (2000 sr 1)

Tks Hans & Paul, it work...

#### Posting Permissions

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