I am having trouble with a macro that I am creating. Here is the scenario: I want to take a range of data from sheet "TEMP" and copy it to a different sheet, based on what is in cell "E" of each row of the "TEMP" sheet. I am getting a "type mismatch" with the code that I have. I am guessing that it is not looking for a string, but a number, and that is why it is giving me the error. I appreciate all of your help!!!
Sub MoveData()
Dim i As Integer, rowNumber As Integer
i = 2 'whatever row your data begins on
rowNumber = ActiveSheet.UsedRange.Rows.Count 'gets used number of rows
Do 'Loops through all data on the sheet
If Worksheets("TEMP").Range("E2:E300").Value = "Admin Operations" Then
Cells.Copy
Sheets("Admin").Select
ActiveSheet.Range("A123").Select
ActiveSheet.Paste
ElseIf Range("E").Value = "Bonifay" Then
Cells.Copy
Sheets("[Bonifay]").Select
ActiveSheet.Range("A123").Select
ActiveSheet.Paste
End If
i = i + 1
Loop Until i = rowNumber
End Sub
Bookmarks