It depends on what type of memory the 6670 has. If it has DDR3 memory, the two cards are on average about even. If it has GDDR5 memory, the 6670 is on average noticeably more powerful than the R7 240. Results can vary slightly depending on the specific game.
The 6670 is a bit faster than the R7 240 because it has GDDR5 RAM. However the R7 240 consumes much less power. The cards perform almost exactly the same so I'd get the R7 240 as it's a bit cheaper.