I have filtered data in worksheet that is missing information in column D. The missing information already filtered out. I want to fill the formula to visible rows in Column D.
I get the first empty visible cell and correct rows count for only visible rows. However the code does not fill the the formula to all visible cells on the range.
This code only writes to first cell that is myCell. The problem seems to be on the last row of the code -> Range("" & CSt....
The amount of data with all the loops is > 200 0000 rows. Therefore a fast method that is focusing only filtered cells is preferred.
Thanks for your help in advance.
Code:
Sub Makro3()
'
Dim myCell As Range
.
.
.
.dim ...
Hyvite = WSc.Cells(r, 7)
WSCust = WSc.Cells(r, 1)
Sheets(WSCust).Select
Sheets("20200").Select
ActiveSheet.AutoFilter.Range.Offset(1).SpecialCells(xlCellTypeVisible).Cells(1, 4).Select
Set myCell = ActiveCell
LastRow = ActiveSheet.AutoFilter.Range.Columns(1).SpecialCells(xlCellTypeVisible).Cells.Count - 1
myCell.FormulaR1C1 = _
"=IFERROR(INDEX('YHT hin'!C,MATCH(RC[-3],'YHT hin'!C[-3],0))+ " & CStr(Hyvite) & ","""")"
Range("" & CStr(myCell.Address) & "").AutoFill Destination:=Range(" & CStr(myCell.Address) & ":F" & LastRow)
End Sub
Can someone help me out to formulate the last row of the code. I cannot find the answer anywhere.