ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Stop fill in the blanks (down) at specific row (https://www.excelbanter.com/excel-programming/441168-stop-fill-blanks-down-specific-row.html)

J.W. Aldridge

Stop fill in the blanks (down) at specific row
 
Works fine. Just need to add command to stop at specific row.
Starts at 25, lets say stop specifically at row 1000.


Sub FillInTheBlanks_1()
Dim Area As Range, LastRow As Long
On Error Resume Next
LastRow = Cells(Rows.Count, "C").End(xlUp).Row
For Each Area In Intersect(Rows("25:" & LastRow), Range("C25"). _
Resize(LastRow).SpecialCells(xlCellTypeBlanks)).Ar eas
Area.Value = Area(1).Offset(-1).Value
Next
End Sub

JLGWhiz[_2_]

Stop fill in the blanks (down) at specific row
 
This should work:


Sub FillInTheBlanks_1()
Dim Area As Range, LastRow As Long
On Error Resume Next
LastRow = Cells(Rows.Count, "C").End(xlUp).Row
For Each Area In Intersect(Rows("25:" & LastRow), Range("C25"). _
Resize(LastRow).SpecialCells(xlCellTypeBlanks)).Ar eas
If Area.Row < 1000 Then
Area.Value = Area(1).Offset(-1).Value
End If
Next
End Sub






"J.W. Aldridge" wrote in message
...
Works fine. Just need to add command to stop at specific row.
Starts at 25, lets say stop specifically at row 1000.


Sub FillInTheBlanks_1()
Dim Area As Range, LastRow As Long
On Error Resume Next
LastRow = Cells(Rows.Count, "C").End(xlUp).Row
For Each Area In Intersect(Rows("25:" & LastRow), Range("C25"). _
Resize(LastRow).SpecialCells(xlCellTypeBlanks)).Ar eas
Area.Value = Area(1).Offset(-1).Value
Next
End Sub




Rick Rothstein

Stop fill in the blanks (down) at specific row
 
Give this a try...

Sub FillInTheBlanks_1()
Dim Area As Range, LastRow As Long
Const StopRow As Long = 1000
On Error Resume Next
LastRow = Cells(Rows.Count, "C").End(xlUp).Row
For Each Area In Range("C25").Resize(LastRow). _
SpecialCells(xlCellTypeBlanks).Areas
If Area.Row + Area.Rows.Count StopRow Then
Range(Area(1), Cells(StopRow, "C")).Value = Area(1).Offset(-1).Value
Exit For
Else
Area.Value = Area(1).Offset(-1).Value
End If
Next
End Sub

--
Rick (MVP - Excel)



"J.W. Aldridge" wrote in message
...
Works fine. Just need to add command to stop at specific row.
Starts at 25, lets say stop specifically at row 1000.


Sub FillInTheBlanks_1()
Dim Area As Range, LastRow As Long
On Error Resume Next
LastRow = Cells(Rows.Count, "C").End(xlUp).Row
For Each Area In Intersect(Rows("25:" & LastRow), Range("C25"). _
Resize(LastRow).SpecialCells(xlCellTypeBlanks)).Ar eas
Area.Value = Area(1).Offset(-1).Value
Next
End Sub



Rick Rothstein

Stop fill in the blanks (down) at specific row
 
That won't stop at **exactly** Row 1000 if Row 1000 (in Column C) is in the
middle of a group of blank cells.

--
Rick (MVP - Excel)



"JLGWhiz" wrote in message
...
This should work:


Sub FillInTheBlanks_1()
Dim Area As Range, LastRow As Long
On Error Resume Next
LastRow = Cells(Rows.Count, "C").End(xlUp).Row
For Each Area In Intersect(Rows("25:" & LastRow), Range("C25"). _
Resize(LastRow).SpecialCells(xlCellTypeBlanks)).Ar eas
If Area.Row < 1000 Then
Area.Value = Area(1).Offset(-1).Value
End If
Next
End Sub






"J.W. Aldridge" wrote in message
...
Works fine. Just need to add command to stop at specific row.
Starts at 25, lets say stop specifically at row 1000.


Sub FillInTheBlanks_1()
Dim Area As Range, LastRow As Long
On Error Resume Next
LastRow = Cells(Rows.Count, "C").End(xlUp).Row
For Each Area In Intersect(Rows("25:" & LastRow), Range("C25"). _
Resize(LastRow).SpecialCells(xlCellTypeBlanks)).Ar eas
Area.Value = Area(1).Offset(-1).Value
Next
End Sub





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

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