zookeepertx
Well-known Member
- Joined
- May 27, 2011
- Messages
- 589
- Office Version
- 365
- Platform
- Windows
Hello experts!
I have a macro that works just like I want, with 1 small exception. When I pull the report to work with, the data is organized in a particular number of rows. However, apparently, sometimes the group/file is, say, 26 rows and sometimes it's 51 to the next set of data. As far as I can tell, it's a consistent number for every set of data each time the report is pulled: if it's 26 rows to the end of 1 file # on that day's report, then the entire report has the same # of rows in each file. (Don't ask me why it can change from day to day; I think it's totally crazy)
The last row in a file always says "Show more information" and there's a blank row after that. So, if the file has 25 rows, that row is 25 and I want to establish the next row (the blank one) as the variable for my For Loop.
So, right now my For Loop if the blank row row is 26 my loop would be:
But if there happens to be 50 rows in each file, then add 1 for the blank row, the loop would have to be Step 51.
I'm thinking if there was a way to find the blank row # after that first occurrence of "Show more information", I'd like to use the number of that row as a variable to tell the macro what the "Step #" should be.
(It wouldn't need to continue finding that "Show more information" row; just use the row # of the first occurrence as a variable to determine what the "Step #" should be)
For example, if the first "Show more information" is row 25, the blank row is 26, so 26 could be i and then the For Loop could maybe be
Or something like that.
Clear as mud, right?
Thanks for any help! I feel like I should be able to figure it out but my brain seems to have abandoned me lately.
Jenny
I have a macro that works just like I want, with 1 small exception. When I pull the report to work with, the data is organized in a particular number of rows. However, apparently, sometimes the group/file is, say, 26 rows and sometimes it's 51 to the next set of data. As far as I can tell, it's a consistent number for every set of data each time the report is pulled: if it's 26 rows to the end of 1 file # on that day's report, then the entire report has the same # of rows in each file. (Don't ask me why it can change from day to day; I think it's totally crazy)
The last row in a file always says "Show more information" and there's a blank row after that. So, if the file has 25 rows, that row is 25 and I want to establish the next row (the blank one) as the variable for my For Loop.
So, right now my For Loop if the blank row row is 26 my loop would be:
VBA Code:
For j = 2 To lr Step 26
I'm thinking if there was a way to find the blank row # after that first occurrence of "Show more information", I'd like to use the number of that row as a variable to tell the macro what the "Step #" should be.
(It wouldn't need to continue finding that "Show more information" row; just use the row # of the first occurrence as a variable to determine what the "Step #" should be)
For example, if the first "Show more information" is row 25, the blank row is 26, so 26 could be i and then the For Loop could maybe be
VBA Code:
For j = 2 to lr Step i
Clear as mud, right?
Thanks for any help! I feel like I should be able to figure it out but my brain seems to have abandoned me lately.
Jenny