Johnny Thunder
Well-known Member
- Joined
- Apr 9, 2010
- Messages
- 693
- Office Version
- 2016
- Platform
- MacOS
Hey guys,
I have this code (below) that looks in column C and searches for values that are greater than 0.01 and if found pastes them in column G as a list. to test I entered in two cells to have values that were greater than 0.01 Cell C5 and Cell C9 and in my results the code is entering cell C5's cell address/Value twice? Not sure what I am doing wrong.
Excel 2010
I have this code (below) that looks in column C and searches for values that are greater than 0.01 and if found pastes them in column G as a list. to test I entered in two cells to have values that were greater than 0.01 Cell C5 and Cell C9 and in my results the code is entering cell C5's cell address/Value twice? Not sure what I am doing wrong.
Excel 2010
Code:
Sub FindVaraince()
Dim ws As Worksheet
Dim c As Range
Dim FinalRow As Long
FinalRow = cells(Rows.Count, 2).End(xlUp).Row 'Finds Last row and excludes header
Set ws = ActiveSheet
For Each c In ws.Range("C2:C" & FinalRow)
If c.Value >= 0.01 Then Rng = c.Address
If c.Value >= 0.01 Then Rng2 = c.Value
ws.Range("G" & Rows.Count).End(xlUp).Offset(1).Value = Rng
ws.Range("H" & Rows.Count).End(xlUp).Offset(1).Value = Rng2
Application.CutCopyMode = False
Application.DisplayAlerts = False
Next c
End Sub