I have made some of the suggested changes that some of you that suggested. It certainly helped but now I am getting a Run Time Error '9' message and when I click debug the following line is highlighted:
Rows(1).Copy Sheets(X).Range("A" & Rows.Count).End(3)(2)
I have created and use Excel 2007. Thanks once again for taking the time to respond with your much appreciated suggestions.
Private Sub cmdSubmit_Click()
Dim d As String
Dim X As String
Dim i As Long
Dim y As Long
Range("AA1").Value = cboTheClassD
cboTheClassD = Empty
frmTheClassDEntry.Hide
X = cboTheClassDName
Sheets.Add.Name = Replace(CStr(X), ":", " ")
Sheets("Master").Activate
d = Range("AA1").Value
i = 1
Do Until ActiveCell.Value = d
Cells(1, i).Select
i = i + 1
Loop
Rows(1).Copy Sheets(X).Range("A" & Rows.Count).End(3)(2)
Sheets(X).Range("A1").EntireRow.Delete shift:=xlUp
Sheets("Master").Activate
For y = 2 To 100000
If Cells(y, ActiveCell.Column) = X Then
Cells(y, ActiveCell.Column).EntireRow.Copy Sheets(X).Range("A" & Rows.Count).End(3)(2)
End If
Next y
Sheets(X).Activate
Cells.Select
Selection.Copy
Cells.Select
Selection.PasteSpecial Paste:=xlPasteValues
Do Until Cells(1, 1) <> ""
Cells(1, 1).Select
Cells(1, 1).EntireColumn.Delete shift:=xlToRight
Loop
i = 1
For i = 1 To Worksheets.Count
Worksheets(i).Tab.ColorIndex = i + 10
Next
End Sub
Bookmarks