Here is simple method to follow:
- add a Boolean variable (= True or False variable)
- create 2 separate conditions like this (using your notation) :
Dim copyTable As Boolean 'place with other declared variables
copyTable = False
If tCell.Value < -0.1 And a-cell < -0.01 Then copyTable = True
If tCell.Value > 0.1 And a-cell > 0.01 Then copyTable = True
If copyTable = True Then
' copy this table
stockview.Rows("1:" & tRows).Insert Shift:=xlDown
t.Range.Copy stockview.Range("A1")
Else
'do not copy this table
End If
To avoid having 2 variables - this code should work if tCell is in columnD and a-cell is in columnA, of SAME row)
Dim copyTable As Boolean 'place with other declared variables
copyTable = False
If tCell.Value < -0.1 And tCell.Offset(0, -3).Value < -0.01 Then copyTable = True
If tCell.Value > 0.1 And tCell.Offset(0, -3).Value > 0.01 Then copyTable = True
If copyTable = True Then
' copy this table
stockview.Rows("1:" & tRows).Insert Shift:=xlDown
t.Range.Copy stockview.Range("A1")
Else
'do not copy this table
End If
Bookmarks