Hi all,
I am very new to VBA after spending the vast majority of my time in Excel writing formula's instead. (And I'm by no means amazing at that)
However something I can do via formula, seems to be very hard for me to achieve in VBA.
Basically I would like a macro that finds the last cell of a column, in my attached example workbook that's Row 26 in Column D, then uses that number 26 to make a new range. Eg E2:E26. (Where D, E, 2 and 26 are all variable)
I have be advised by a friend of mine to make sure all variables are kept at the top of the code so they can easily be changed if needs be rather than trawling through code.
Equally they advised me to make sure I refer to the workbook and sheet, so the macro can be used in other places and with consequences while running. (Similarly I avoid select and activate where possible)
I have attached a sample workbook and included a basic example of what I'm after. (And one of my latest failings)
Finally it's worth mentioning that I have tried this with loop and although it works, it's not practical to use in my original file which has over 1000+ rows so it would be a lot of volatile random numbers.
I more hope to make a range based on the number of rows in a different column and then later refer to that new range to manipulate with copy etc.
Cheers in advance
EricDonk
Edit: I have tried to find an answer to this using all sorts, but everything I saw online doesn't actually do what I'm after.
Bookmarks