• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Run a macro from last populated cell.

Hello everyone I would like to set a macro to run when I hit return. I dont know how to acheive this, so some help from you guys would be much appreciated.

I would like to instruct a macro to run on the last populated cell in colunm"G". I have set a shortcut to run (ctl+u) but it would be more effecient to have this run automatically. When the cell is the last cell populated then hit return. I cannot specify a row reference as the colunm "G" gets larger everyday. In other words it is the last cell that is populated in "G". I hope that I am not to confusing?
Thanks
 

Marc L

Excel Ninja
Hi,​
start to set your macro VBA procedure using the worksheet event Worksheet_Change in the worksheet code module …​
 
Hello Marc L, I tried your recomendation using the shortcut as well as both return keys, but it appears that the macro did not run. VBA is a mystery to me as I have never in the past 40 years needed to use it. I have att. a scr shot for you to veiw in case I mis-interperated your comment.

693431592926895950.png
 
Hi Marc L I have now got the macro to run, ( I spotted my errors). I have colunms before "G" that have data inputed. Using the change command as you advised causes the macro to run after cell has data added. Is it not possible to ensure that only after "G" has been populated that the macro will run? I am sorry if I have set some confusion.

Thank you
 

Marc L

Excel Ninja
With the event the shortcut is very not necessary like the OnKey statement on the Enter key as well …​
Just check the Column property of the Target object variable of this event procedure.​
 
Top