Hello, someone can recognize me with my questions, someone not. At start want to wish you good weekend.
Heres my question:
How to create dynamic range using variables? Macro should copy 20 rows from bottom to another sheet, but there are some complications:
Below, on the image we see that macro should copy these rows correctly because we have more than 20 rows
But how to solve problem if there is not even 20 rows to copy:
As you see, the criteria of these rows is status "NOT OK", ofcourse I can use filters, so using variable f.e. lastRow should get me last 20 rows if its more than 20+. But what if there is not even 20 rows to copy?
If I understand, we should declare 2 variables to help us: lastRow and firstRow(first row after headers). All should be done within IF loop?
Someone can help me with code of this IF if I correctly understand that its neccessary to create dynamic range using IF loop or there is better solution?
Thanks
Heres my question:
How to create dynamic range using variables? Macro should copy 20 rows from bottom to another sheet, but there are some complications:
Below, on the image we see that macro should copy these rows correctly because we have more than 20 rows
But how to solve problem if there is not even 20 rows to copy:
As you see, the criteria of these rows is status "NOT OK", ofcourse I can use filters, so using variable f.e. lastRow should get me last 20 rows if its more than 20+. But what if there is not even 20 rows to copy?
If I understand, we should declare 2 variables to help us: lastRow and firstRow(first row after headers). All should be done within IF loop?
Someone can help me with code of this IF if I correctly understand that its neccessary to create dynamic range using IF loop or there is better solution?
Thanks