It is true that Marx quite often denounces morality. By this, however, he meant the kind of historical inquiry which ignores material factors in favour of moral ones. The proper term for this is not morality but moralism. Moralism abstracts something called “moral values” from the whole historical context in which they are set, and then generally proceeds to hand down absolute moral judgements.