vba - Is there a limit to the number of cells called on in a source range? -
i pieced visual basic code pulls data cells in multiple workbooks , creates master summary workbook. want include large number of cells each workbook, sub stops working if include many cells in source range. first section of code below works fine. if add more cells (second section of code), sub still runs, generates blank workbook. rest of code identical in both cases. there maximum number of cells/ characters can include in command? so, think wouldn't exceed such limit.
this code works fine
mybook.worksheets(1) set sourcerange = .range("j2, c2, d7, f7, k7, g10, j10, g11, j11, g12, j12," _ & "g14, j14, g15, j15, g16, j16, g17, j17, j21," _ & "j2, d24:e24, g24, i24, j24, o24:s24," _ & "d25:e25, g25, i25, j25, o25:s25," _ & "d30:e30, g30, i30, j30, o30:s30") end
this code returns blank worksheet
with mybook.worksheets(1) set sourcerange = .range("j2, c2, d7, f7, k7, g10, j10, g11, j11, g12, j12," _ & "g14, j14, g15, j15, g16, j16, g17, j17, j21," _ & "j2, d24:e24, g24, i24, j24, o24:s24," _ & "d25:e25, g25, i25, j25, o25:s25," _ & "d26:e26, g26, i26, j26, o26:s26," _ & "d27:e27, g27, i27, j27, o27:s27," _ & "d28:e28, g28, i28, j28, o28:s28," _ & "d29:e29, g29, i29, j29, o29:s29," _ & "d30:e30, g30, i30, j30, o30:s30") end
i've tried using different cells , have same problem; seems number of cells choose, not in cells in original workbook, problem.
that "a1, b1, c1"
syntax shorthand range.union
- use explicit range.union
calls , sky limit!
wiki
Comments
Post a Comment