excel - Build a pivot out of an array built and named in VBA -


i'm trying reference source data of pivot name. have following code:

set rng1 = sheets("cala current credit usage").range("a1:l235") set rng2 = sheets("cala forecast credit usage").range("a2:l235")  dim myarray() totalrows = rng1.rows.count + rng2.rows.count + 1 redim preserve myarray(1 totalrows, 1 rng1.columns.count)  = 1 rng1.columns.count     j = 1 rng1.rows.count         myarray(j, i) = rng1.cells(j, i)     next j next  j = j - 1  '''''' h = 1 rng2.columns.count     w = 1 rng2.rows.count         myarray(w + j, h) = rng2.cells(w, h)     next w next h  activeworkbook.names.add name:="resultingrange", refersto:=myarray 

but when linked pivot resultingrange got:

data source reference not valid.

any ideas?


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -