-
Greetings Skywalker,
This is a tad sloppy, but in a test copy of your wb, try:
In a Standard Module:
[vba]
Option Explicit
Sub TackValsFromAbove()
Dim wks As Worksheet
Dim rngInitial As Range
Dim rcell As Range
Dim rngLCol As Range
Dim rngCellInCol As Range
Dim rngCellInRow As Range
Dim rngRow As Range
Dim i As Long
Dim bolFoundAVal As Boolean
Set wks = ThisWorkbook.Worksheets("Sheet1") '<---Change to suit
With wks
Set rngLCol = .Range(.Cells(2, 1), _
.Cells(Rows.Count, Columns.Count)) _
.Find(What:="*", _
LookIn:=xlValues, _
LookAt:=xlPart, _
SearchOrder:=xlByColumns, _
SearchDirection:=xlPrevious)
.Columns(1).AutoFilter 1, "Yes"
Set rngInitial = .Range("A2:A" & .Cells(Rows.Count, 1).End(xlUp).Row) _
.SpecialCells(xlCellTypeVisible)
.Range("A:A").AutoFilter
For Each rngCellInCol In rngInitial
Set rngRow = .Range(.Cells(rngCellInCol.Row, "B"), _
.Cells(rngCellInCol.Row, rngLCol.Column))
For Each rngCellInRow In rngRow
If rngCellInRow.Value = vbNullString Then
i = 0
Do
i = i - 1
If Not rngCellInRow.Offset(i).Value = vbNullString Then
With rngCellInRow
.Value = .Offset(i).Value
.Interior.ColorIndex = 3
bolFoundAVal = True
End With
End If
Loop While Not bolFoundAVal
bolFoundAVal = False
End If
Next
Next
End With
End Sub
[/vba]
Question for others: (ie- HELP?!):
What am I not seeing? Why would not:
[vba]
Loop While Not rngCellInRow.Offset(i).Value = vbNullString
[/vba]
kill the looping???
Mark
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules