Hi,
I have the following code that looks at a list of codes and if a mtach is found changes the values of other cells on that row.
I currently have the list of codes in the same workbook but want to move it to another workbook, I have tried to change the code but cant get it to work when I move it, can anyone help and also make any other suggestions on how to imptove the code as I am still learning?
The code currently runs on sheet Data, I would like to move the code list to sheet Base
Regards Damian
I have the following code that looks at a list of codes and if a mtach is found changes the values of other cells on that row.
I currently have the list of codes in the same workbook but want to move it to another workbook, I have tried to change the code but cant get it to work when I move it, can anyone help and also make any other suggestions on how to imptove the code as I am still learning?
The code currently runs on sheet Data, I would like to move the code list to sheet Base
Regards Damian
Code:
Sub Naturals()
Dim Rng As Range
Dim Rng1 As Range
Dim C As Range
Dim D As Range
With Application
.ScreenUpdating = False
.Calculation = xlCalculationManual
End With
Set Rng = Range(Range("CO2"), Range("CO" & Rows.count).End(xlUp))
Set Rng1 = Range(Range("O2"), Range("O" & Rows.count).End(xlUp))
For Each D In Rng
For Each C In Rng1
If C.Value = D.Value Then C.Offset(, -7).Value = "Natural"
If C.Value = D.Value Then C.Offset(, -6).Value = "Natural"
If C.Value = D.Value Then C.Offset(, -5).Value = 0
If C.Value = D.Value Then C.Offset(, -4).Value = 0
If C.Value = D.Value Then C.Offset(, -3).Value = 1
If C.Value = D.Value Then C.Offset(, -1).Value = 1
Next C
Next D
With Application
.Calculation = xlCalculationAutomatic
.ScreenUpdating = True
End With
End Sub