ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Find non blank cell in range and fill the rest with that value (https://www.excelbanter.com/excel-programming/416120-find-non-blank-cell-range-fill-rest-value.html)

LuisE

Find non blank cell in range and fill the rest with that value
 
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 cant use fill down, up, etc by default.

Thanks in advance


Gary''s Student

Find non blank cell in range and fill the rest with that value
 
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

--
Gary''s Student - gsnu200801


"LuisE" wrote:

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 cant use fill down, up, etc by default.

Thanks in advance



All times are GMT +1. The time now is 01:08 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com