How to troubleshoot incompatible types error in vba?

Asked

Viewed 27 times

0

I am trying to go through a list of filtered results in VBA and found the following syntax, however when running appears "Incompatible types"

loc13 = Workbooks("Histórico 2013-2021.xlsx").Worksheets("Memória Intervenções").AutoFilter.Range.Columns(17).Rows(j).SpecialCells(xlCellTypeVisible).Value
Debug.Print (loc13)
  • Save it, my dear! I’d say you’re using the AutoFilter wrong... You could say what you intend to put in the variable loc13? Also, what is the type of the variable and what appears if you put a Debug.Print Workbooks("Histórico 2013-2021.xlsx").Worksheets("Memória Intervenções").AutoFilter.Range.Columns(17).Rows(j).SpecialCells(xlCellTypeVisible).Address?

  • In the variable loc13 I want to put the filtered value and go through with a FOR. When debugging this line of code, it returns me the first visible value (which was expected), however when continuing for, it does not update the values of the next lines. Just give me the first value

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.