There are two things I hope to achieve in a Macro.
1) I want to have a formula copy in a column to the exact # of rows adjacent to it. For example, I begin pasting data into column A which will be a variable # of rows, between 100 and 5000. Then I trigger a Macro that will enter a Vlookup formula in column B, then copy down as long as there is data in column A. My usual method is use an "if" statement along with Vlookup, something like "If there is a number in cell A2, then use vlookup in B2, else return no value" (something like that at least). Then I just copy this down enough rows to guarantee that it won't miss any data in column A. In my example then I would probably copy it down to row 6,000 which gives me 1,000 rows of cushion since I don't expect to every paste more than 1000 rows at a time.
So, is there another way to achieve my desired results? The problem I have with my current method is that when I am done the workbook will be larger than it really is and if I choose to print it I will get lots of blank pages, especially if the pasted file was on the small side (say 100 rows).
2) Next issue, the vlookup itself is pulling from a dynamic sized table. The table always has the same # of columns, but the rows grow/shrink (range is 4,000 to 8,000). Again, I usually just choose my table array in Vlookup to be for the max+ some safety cushion, say 9000 rows, but I was interested if there was a way to make the list dynamic.
Thanks for any help
Bookmarks