Hello, I hope someone can help me with this macro.

I want to change the size of all the images that I have and I tried recording my actions and making adjustments but I always end up grabbing all the images together to be made of a single size, not one by one, so after trying and trying I finally could, but There will always be variations in the amount of images, is there a way to adjust it depending on how many there are in the layer?

Thank you