How do I write code to perform a function on dynamic cell range?

  • Hello friends,

    I am a vba novice, and need help in figuring out a 'simply' isssue I'm facing.

    I am creating an inventory management userform, and I aim to include a code to give notification (MSgBox) whenever 'Reorder level units = Available inventory units ".

    In the attachment, my code works only for the first Product item in cell Row 2, but I am unable to get it to work on subsequent Products items down the rows in a dynamic way. Please note that cell range here is dynamic (Product items are added routinely).

    I have tried .autofill and other ways on the internet, but I just can't get it right. Please help. Thanks in advance.

  • Why would you need VBA to do this? Conditional Formatting would be more efficient.

    An image is not much use if you want help with Excel, attach an example workbook.

  • royUK Yes, you are right, the image wasn't useful to get me the help. I know this now because I have resolved the issue, and it was a minor code error that none could have figured out without having the workbook. Thanks for taking the time to help me, and sorry for posting this ambiguous thread.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!