as I am a complete newb in VBA, I have a question.
I have a column of integers, which I want to divide by 60. The column is "X". Here's my code:
For Each element In Worksheets("parsed").Range("X1:X" & MaxRows).Cells
element.Value = element.Value / 60
Next
But I always get "type mismatch". What I am doing wrong?
First, make sure that you declare
elementas a range. Second, remove the.cellsfrom your loop. This then effectively says in your loop statementFor each cell in the rangelike so:I've made the assumption that
MaxRowsis intended as the last row in columnXof the worksheet.