I'm having a problem. At my work we often get spreadsheets with locations. We need to spread out each of the locations to a different worksheet. Because then we list nearby businesses to advertise to. This wasnt much of a problem when they gave us spreadsheets with 5 locations, but more recently we've been getting sheets with upwards of 100 locs on one sheet.
I want to make a function that takes a given row, takes the first value and make it's content (location number) into a new sheet. Copy that row to the sheet named for it, and paste it. This is my current code. I'm having problems with "Type mismatch" and "Object required". Any suggestions on these issues?
Sub TestRowThree() Dim row As Integer row = 3 CopyRow (row) End Sub Sub CreateNewSheet(strName As String) Sheet.Add.Name = strName End Sub Sub CopyRow(rowNum As Integer) Dim mainSheetName As String mainSheetName = ActiveWorkbook.ActiveSheet.Name Dim newSheetName As String newSheetName = Sheets(mainSheetName).Range("$A$" & rowNum).Value Sheets(mainSheetName).Select Range("A" & rowNum & ":H" & rowNum).Cut CreateNewSheet (newSheetName) Sheets(newSheetName).Select Range("A" + rowNum + ":H" + rowNum).Select ActiveSheet.Paste End Sub