I want to add two separate command buttons to a worksheet, one for "team A" and one for "team B", but each button will essentially serve the same function. I need the buttons to check the contents of the cells in column L and build a variable that contains the contents from cells D, E, F, & G of the same row if a certain value exists. The data to be reviewed will always start in cell L5 but the end cell in column will vary in each file.
I have working code to get the last cell in the sheet and define the range of cells to test in column L. I'm having issues defining a loop to check each of the cells and build the variable.
For simplicity, if L5 = "A", then I want to write the contents from D5-G5 to my variable and check the next cell in the range. If L5 <> "A" I want to skip it and check the next cell in the range.
This is my rough code:
I have working code to get the last cell in the sheet and define the range of cells to test in column L. I'm having issues defining a loop to check each of the cells and build the variable.
For simplicity, if L5 = "A", then I want to write the contents from D5-G5 to my variable and check the next cell in the range. If L5 <> "A" I want to skip it and check the next cell in the range.
This is my rough code:
Code:
myTempVar = ""
myFinalVar = ""
For Each y in myRange
If y = "A" Then
' do something to get data from cells D-G here (need to separate values with a comma or similar)
' append the temp variable to the final variable
myFinalVar = myFinalVar & myTempVar & Chr(13)
End If
Next y