Find non blank cell in range and fill the rest with that value

  • Thread starter Thread starter LuisE
  • Start date Start date
L

LuisE

There is only one non-blank cell in a given range; I need to populate the
rest of that range with that value. The cell containing the value could be
anywhere in that range so I can’t use fill down, up, etc by default.

Thanks in advance
 
Select the range and then:

Sub FillRange()
v = ""
For Each r In Selection
If r.Value <> v Then
v = r.Value
Exit For
End If
Next
Selection.Value = v
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top