Cells reference not working in Excel VBA 2010 Function

前端 未结 3 1172
长发绾君心
长发绾君心 2020-12-11 12:01

I am attempting to write a function that takes a range of data and calculates the ratio of two numbers from the columns provided by the user. I want to print this ratio out

3条回答
  •  时光说笑
    2020-12-11 12:49

    Try adding Dim temp as Range and chagne temp = table.cells(counter, table.columns.count) to set temp = table.cells(counter, table.columns.count)

    Really all you need to do is add the set, without it the Variant temp is becoming a long, with it the Variant would become a Range object.

提交回复
热议问题