excel - Using range based on variables only -


i'm trying use range operator based on variables there "application defined object defined error". i've tried this:

thisworkbook.sheets(1).range(cells(lfirstrow, cint(k)), cells(xllastrow, cint(k))).value = thisworkbook.activesheet.range("b5:b" & xllastrow).value 

and this:

if k > 26     kletter = chr(int((k - 1) / 26) + 64) & chr(((k - 1) mod 26) + 65) else     kletter = chr(k + 64) thisworkbook.sheets(1).range(lfirstrow & kletter & ":" & xlastrow & kletter).value = thisworkbook.activesheet.range("b5:b" & xllastrow).value 

where k loop counter , defined integer.

xllastrow llastrow+1, llastrow is

llastrow = .range("a" & .rows.count).end(xlup).row 

lfirstrow 11 @ beginning , lfirstrow = lfirstrow + llastrow - 5

what's wrong?
in advance.


Comments

Popular posts from this blog

c# - How to get the current UAC mode -

angularjs - ng-repeat duplicating items after page reload -

javascript - What's causing this slow/delayed audio playback in Safari? -