Hello there,
The following code should work for you:
Dim c As Range, LR As String, x As Long, y As Long
x = 5 'set x equal to 5, will be used to reference the starting paste to row for sheet2
y = 5 'set y equal to 5, will be used to reference the starting paste to row for sheet3
With Sheets("Sheet1")
'LR = .Range("A6555").End(xlUp).Row 'set LR equal to the last row in column A on sheet1
For Each c In .Range("B5:B40").Cells 'loop through cell in column B starting at row 5 and ending at row 40
Select Case Left(c.Value, 1) 'if the first letter of the current cell in the loop is...
Case "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L" 'any of these letters then...
Sheets("Sheet2").Cells(x, 2) = c.Value 'set the cell in worksheet sheet2 row x
'(defined as starting at 5 and will increment 1
'every time a value is added to sheet2) column B (aka 2)
x = x + 1 'increment x by one so that you don't copy the value over the existing values
Case "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" 'if the first letter of the current cell in the loop is...
Sheets("Sheet3").Cells(y, 2) = c.Value 'set the cell in worksheet sheet3 row y
'(defined as starting at 5 and will increment 1
'every time a value is added to sheet3) column B (aka 2)
y = y + 1 'increment y by one so that you don't copy the value over the existing values
End Select
Next c 'move to next cell in the loop
End With
To insert this code into your workbook
1. Press Alt+F8
2. Clear the macro name field and then type DistributeVal
3. Select the create option
4. In between the Sub DistributeVal() and End Sub copy and paste the above code. Anything that appears in green is a comment meant to help you understand.
5. Exit out of Visual Basic
6. Press Alt+F8
7. Select the DistributeVal macro
8. Select the Run option
Let me know if this works for you.
Thanks!
Bookmarks