I've written 2 macros to do this task but I'm trying to consolidate and make it more efficient.
- If there is a value = 1 in column
I(it will either be blank or = 1) then look at columnG - If the Value in column
G< 30 OR if the Value in columnH< 0.03 THEN overwrite the value in column I to = "0" ... (if not then don't change the value in columnIand move on to check the next)
The Ranges are I9:I45000, G9:G45000, and H9:H45000.
I think there is a simple solution but after a few hours my un-educated self can't find it.
Module1:
Dim rngCell As Range, _
rngDataRange As Range
Set rngDataRange = Range("G9:G45000")
For Each rngCell In rngDataRange
With rngCell
If .Value < 30 Then
.Offset(0, 2).Value = "0" 'A[rngCell] to C[rngCell]
End If
End With
Next rngCell
End Sub
Module2:
Sub Macro1()
Dim rngCell As Range, _
rngDataRange As Range
Set rngDataRange = Range("H9:H45000")
For Each rngCell In rngDataRange
With rngCell
If .Value < 0.03 Then
.Offset(0, 1).Value = "0" 'A[rngCell] to C[rngCell]
End If
End With
Next rngCell
End Sub
This is the macro I run first.... It puts values in some of the cells in column I (where column C has values less than 1575):
Sub Macro1 () Dim rngCell As Range,_ rngDataRange As Range
Set rngdataRange = Range (C9:C45000)
For Each rngCell In rngDataRange
With rngCell
If .Value < 1575 Then
.Offset (0,6).Value="1"
End If
End With
Next rngCell
End Sub