View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] c1802362@cox.net is offline
external usenet poster
 
Posts: 17
Default Understanding Issues with INTERSECT function in VBA

Good morning.

In an application I'm currently developing, I read two two pieces of data from a list (x,y), then map each x,y pair into a table which has X columns and Y rows.

Everything works fine except I've found that if I don't select the row and column prior to using the intersect function the routine fails with the following error:

Run-time error 13: Type mismatch

My pseudo code looks like:

do for the list of values

find the column in the table corresponding to the X value in the list
set column as rngX
rngX.Select

find the row in the table correcponding to the Y value in the list
set row as rngY
rngY.select

application.Intersect (rngX, rngY) = application.Intersect (rngX, rngY)+1

loop

If I don't include both rngX.Select and rngY.Select commands in exactly the sequence shown the code does not work. Any explanation why?

Art