Loop or For Each in a Select Case Statement

  • Hello World:


    Need advice or an example of how to loop through a range of cells to execute the below Select Case Statement for Each occuring case.


    Example: If the value of "Windows 7 Enterprise 64 bit Edition Service Pack 1" occurs in any of the cells in Range R2, then each cell in the correspondeing cell location in Range AV2 should enter a value that reads "End User Support" and then so on for each successive Case. Let me know if I'm not clear on this please!



    Please and Thank you

  • Re: Loop or For Each in a Select Case Statement


    see if this works for you.


  • Re: Loop or For Each in a Select Case Statement


    Bryce, thank you for taking the time to assist. The code runs but with no results. As I debug through each line I'm seeing that the code is bypassing the Case Clauses within the Select Case block (jumping from the "For x = 2....." and not touching anything in between....then jumps to "End Sub". I tried to moving around a few lines of code like the "For X =2...." with no success. Everything else appears to be referencing correctly.


  • Re: Loop or For Each in a Select Case Statement


    Column R is the column that you want to evaluate right? Also, I set the worksheet to Sheet1. This is the code name. Did you change that? If you post a sample I can help you out better.

  • Re: Loop or For Each in a Select Case Statement


    I left the code name for the Sheet as is. Yes, column R has the conditions for the case statement to evaluate. The below snapshot has columns concealed but the two in question are visible (I'm assuming you meant a snapshot of the data I'm working with. If not, please let me know) :


    [ATTACH=CONFIG]72078[/ATTACH]

  • Re: Loop or For Each in a Select Case Statement


    I solved it. I completely forgot that I have the code stored in a module under my personal macro workbook. The code works fine when I reference the workbook and sheet number for it to execute under!


    Thank you again!

Participate now!

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