Hi all,
I was inspired by some help I received on here earlier today to fix some code that was concerning me because it relied on a hard coded column number. I have a similar problem with this code where I have hard coded in the range of the data, but a more robust solution is that the code would search for the correct end of the range.
Basically, I need to sort some columns themselves in Alphabetical ascending order. The code below does that. What I didn't know how to do is to tell it where the range needs to end, so I hard coded it. A better solution would be for the macro to know where to end the range by searching for a string and then offsetting the range 1 to the left of where it found that string.
In Row B, the first column header which should NOT be included in range has the name "# Program Placeholder". I need the code to find that header name, and then define the range as being offset 1 column to the left of it. Currently, "# Program Placeholder" is in column BG (BG1) and so I have hard coded the range to be B1:BF1
Is this possible?
If this is possible, I have another one that is almost the same need. The hard coded range BEGINS where "# Program Placeholder" is located and then I have it ending in some far far away column. An even better solution for this would be for the code to find where "# Program Placeholder" is and then set the beginning range for that cell, then find the last column where row 1 has data in it and set the end range for that cell.Please Login or Register to view this content.
Thanks for your time and expertise!Please Login or Register to view this content.
Bookmarks