Counters?, Count Rows?, Get Rows? in an Excel Macro

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have an indepth macro created with a very dynamic dataset. The macro is
copying data from one sheet; pasting to another based on a sales person's
name (looping to encompass all rows where the criteria is met). I need Excel
macro VB code (while the application is performing the loop based on the
sales person's name) to only copy UP TO 10 ROWS of data. One week there may
only be 2 rows, the next there could be 20; my original report only calls for
10 entries. Can anyone offer the code needed?
 
Assume rng holds a reference to the unconstrained cells to copy

nRows = Application.Min(rng.rows.count,10)
rng.Resize(nRows).Copy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top