Thread: [Solved] Hide and Unhide Rows If....
View Single Post
 
Old 03-20-2020, 06:59 PM
NoSparks NoSparks is offline Windows 10 Office 2010
Excel Hobbyist
 
Join Date: Nov 2013
Location: British Columbia, Canada
Posts: 842
NoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of light
Default

Quote:
1. How do I make the formula accommodate the expanding range
If you use real Excel tables that is automatic.
I guess the issue here would be how you are inserting your new data.
Here's a couple of links to sites with info on tables that is essential for vba.
Excel: Working with Tables (VBA)
The VBA Guide To ListObject Excel Tables — The Spreadsheet Guru

Quote:
2. Why does the formula extend to row 2626?
Eliminate the 26 you have inside the quotes. As you have it now
ws.Range("B" & ws.Rows.Count).End(xlUp).Row gives a result of 26
which is added to the end of what is between the quotes giving you F2:F2626
Reply With Quote