excel - How to use a passed through integer in a range when copying cells -


i've looked around on internet , found no sucess. problem im trying copy range of p6 p(value of integer passed in sub) first worksheet values b2 b(the value passed through) of second worksheet:


sub copy_cells(length integer)  worksheets("sheet2").range("b2: b+length").value = activesheet("sheet1").range   ("p6:p+length").value  end sub 

enter code here

could use

worksheets("sheet2").range(worksheets("sheet2").cells(2, 2), worksheets("sheet2").cells(length, 2)).value  =   worksheets("sheet1").range(worksheets("sheet1").cells(2, 16), worksheets("sheet1").cells(length, 16)).value  

Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -