You can run the macros either from the Visual Basic Editor (VBE) by placing your cursor in the macro and pressing the F5 key, or from Excel by opening the Macros dialog box (ALT+F8) choosing the macro to run and clicking Run
The Range Object returned will of course be the Range where the value being sought resides.The single best way to get the code needed for the Find Method is to record a macro using it on any Excel Worksheet
I think I'll go with the Find function and your suggestion of changing the 'After' argument to the last cell (and yes, you're right to be picky - I should qualify the counts with the worksheet name) as it seems to do everything I want, and it calculates them in the blink of an eye. Up till now I had just used the code above which I ripped from somewhere on the internet (like this site) without understanding the components of the Find function
excel - Error in finding last used cell in VBA - Stack Overflow
So if for example you enter something in B3 and something else in H8 and then later on delete the contents of H8, pressing Ctrl + End will still take you to H8 cell. This criterion usually produces unexpected results, but it may also be intentionally exploited (less often, surely), e.g., to highlight or print specific regions, which may eventually have no data
Find Last Cell Used in Column
I thought it would be something like that, I tried a whole bunch of variations but it still didn't work but your knowledge of VB is far superior to mine so it worked as requested. Copying the range up to row 8 creates problems later on when I am processing the data in columns A and B as it too won't recognize the "real" last cell used in the column
Find the last cell address using vba excel - Stack Overflow
Why do you think the existing code samples are inapplicable? Finding the row number of the last used cell in a column sounds like exactly what you need. I was wondering what code would work so that I can either find the row number and somehow tie it in with my range code so that it will equal "A" + lastrownumber? OR if there is code that will provide the column and row number together? If I have missed the link to the correct answer a simple link will do as well and I apologize for the post and your time
No comments:
Post a Comment