How to execute a function for each cell in a column and loop through all workbooks? How to execute a function for each cell in a column and loop through all workbooks? vba vba

How to execute a function for each cell in a column and loop through all workbooks?


Please change this line:

For Each c In ActiveSheet.UsedRange.Columns("D").Cells

into this one:

For Each c In ws.UsedRange.Columns("D").Cells

In your code internal loop refers to activesheet while it should refer to ws variable representing sheet.