ambarrovecchio
New Member
- Joined
- Jun 7, 2007
- Messages
- 28
Hello all,
I'm trying to get a Select Case macro to work, but I can't quite get it to do what I want. I created a spreadsheet with names of fruit in column A, and I want the macro to copy all of the "Apple" entries into a sheet called "Apple," and the same with "Banana" and "Cherry." However, for all others (Case Else), I want the rows to go into a sheet called "Others."
Instead of splitting the rows up into the different sheets, it dumps all of the data into the "Others" sheet. The code is below. Can someone please help me? I don't understand why it isn't working. Thanks!
I'm trying to get a Select Case macro to work, but I can't quite get it to do what I want. I created a spreadsheet with names of fruit in column A, and I want the macro to copy all of the "Apple" entries into a sheet called "Apple," and the same with "Banana" and "Cherry." However, for all others (Case Else), I want the rows to go into a sheet called "Others."
Instead of splitting the rows up into the different sheets, it dumps all of the data into the "Others" sheet. The code is below. Can someone please help me? I don't understand why it isn't working. Thanks!
Code:
Select Case Range("A1:A25").Text
Case "Apple"
Rows.Copy Sheets("Apple").Range("A" & Rows.Count).End(xlUp)
Case "Banana"
Rows.Copy Sheets("Banana").Range("A" & Rows.Count).End(xlUp)
Case "Cherry"
Rows.Copy Sheets("Cherry").Range("A" & Rows.Count).End(xlUp)
Case Else
Rows.Copy Sheets("Others").Range("A" & Rows.Count).End(xlUp)
End Select