![how to write a macro in excel 2016 to reorganize data how to write a macro in excel 2016 to reorganize data](https://images.squarespace-cdn.com/content/v1/52b5f43ee4b02301e647b446/1415064858021-0M6JF6QARP5E5CSPOBIE/image-asset.jpeg)
This macro always takes you to the proper cell-it works as you would expect Ctrl+End to always work. All you need to do is adjust the macro as follows: There is no intrinsic macro command that does that, but there is a way to force Excel to do the reset. What's needed is a way to reset the "last cell" indicator, just as if you had saved and reopened the workbook.
#How to write a macro in excel 2016 to reorganize data code#
This same problem affects the macro code shown in the FindLast1 macro it will take you to the "highest" cell, regardless of which columns or rows you have deleted during the current session.
![how to write a macro in excel 2016 to reorganize data how to write a macro in excel 2016 to reorganize data](https://dizishala.com/wp-content/uploads/2022/03/e80f4193-953d-471e-b5f7-f0652d8a9712.jpg)
It doesn't it still takes you to cell F27, until you save the workbook and reopen it. If you then delete 3 rows and one column, you would expect that Ctrl+End would take you to cell E24. For instance, let's suppose that you open a workbook, press Ctrl+End, and you are taken to cell F27. However (and this is a big issue), Excel doesn't dynamically keep track of which rows and columns are the last used in a worksheet. To filter macros macro recording>Click data tab>select filter button>stop macro. A dialog box will open then select the macro for adding filters and click Run. Run macro: To run the macro on the new set of data open the data, go to View > Macros > View Macros. This is functionally the same as pressing Ctrl+End. This macro is now available to use on the next set of data needing filters added. To do this same task from a macro, you use a very simple command, as shown here:ĪctiveCell.SpecialCells(xlLastCell).Select Thus, if the last column in which you have data is column F, and the last row in which you have data is row 27, then Ctrl+End will select cell F27.
![how to write a macro in excel 2016 to reorganize data how to write a macro in excel 2016 to reorganize data](https://www.excelcampus.com/wp-content/uploads/2018/07/Select-the-Developer-checkbox-and-then-click-OK.png)
What the shortcut does is to choose the cell that represents the intersection of the last column containing data and the last row containing data. If you are working in a worksheet, you know that you can press Ctrl+End to jump to the last-cell in the worksheet.