Is it possible to set the value of myTerm using a series of If statements?
I have 3 columns in a worksheet which will have data added to them over the course of the year.
I have the following scenarios:
K has data and M & O = "Autumn"
K and M have data and O is empty = "Spring"
K, M and O all have data = Summer
I have written the following (a snippet of the full code):
Sub FilterProgressData()
Dim myTerm As String
If SrcWs.Cells(i, "O").Value = "" And SrcWs.Cells(i, "M").Value = "" And _
SrcWs.Cells(i, "K").Value <> "" Then
myTerm = "Autumn"
ElseIf SrcWs.Cells(i, "O").Value = "" And SrcWs.Cells(i, "M").Value <> "" _
And SrcWs.Cells(i, "K").Value <> "" Then
myTerm = "Spring"
ElseIf SrcWs.Cells(i, "O").Value <> "" And SrcWs.Cells(i, "M").Value <> "" _
And SrcWs.Cells(i, "K").Value <> "" Then
myTerm = "Summer"
but get a 'Run-time error '1004' error - Application-defined or object-defined error'
Any advice will be gratefully received!
Thanks.
Aucun commentaire:
Enregistrer un commentaire