I want to scan a column of numbers that occasionally contain some values that have either "< 0.000" or a "> 10" listed. When I find them, I need to write a slightly different string set to an adjacent column. I also need to write an integer to a third column as a FLAG. So when I find the "< 0.000", I need to replace it with a "<" and the cell value I have stored elsewhere (e.g., "N31"), then write a 5 to an adjacent cell on the same row. A similar activity occurs with the "> 10.4" except there is a multiplication that occurs to create the inserted value after the ">". Finally, an integer 2 is inserted into the same column as the 5.
I tried to run this code but it came back with 'undefined function' at the DilFactor line where I was trying to multiply two cell values. My apologies as I couldn't find the section that indicated that I had code to upload on the Post New Thread section.
Thanks for your help.
Code:
Sub TEST1()
' This sub designed to screen for occurrences of "<" and ">" in Columns "6" and "8" respectively & insert appropriate answers in Column "8" and then insert corresponding flags in Col "9"
Dim patternLESS As String
Dim patternMORE As String
Dim j As Integer 'j = row
Dim I As Integer 'i = column
Dim DilFactor As Long
patternLESS = "<"
patternMORE = ">"
For j = 77 To 86
If Cells(j, 6) = patternLESS Then
Cells(j, 8) = "<" & "N31"
Cells(j, 9) = 5
End If
Next j
For j = 77 To 86
If Cells(j, 6) = patternMORE Then
DilFactor = Cell(j, 7).Value * Cell("N22").Value
Cells(j, 8) = ">" & "DilFactor"
Cells(j, 9) = 2
End If
Next j
End Sub
I tried to run this code but it came back with 'undefined function' at the DilFactor line where I was trying to multiply two cell values. My apologies as I couldn't find the section that indicated that I had code to upload on the Post New Thread section.
Thanks for your help.
Last edited by a moderator: