CorrieAnn Gillen
New Member
I have struggled with this code for a while now. I got this snippet off of this site, but I don't understand how to alter it to suit my needs:
 
	
	
	
		
 
Specifically, my key column is Column A. That is where the rep names reside and where I need the workbook to do it's splitting. The code above uses column C, therefore this line adjust for column C:
 
	
	
	
		
 
I have tried to change the offset to (0,0) but that didn't work. I am not sure how to work with this line.
 
I also get an error on this line, stating that it isn't defined:
	
	
	
		
 
Can someone help me? I just have a spreadsheet with data in columns A: AF that needs to be split out to individual sheet tabs based on rep name, which resides in column A.
 
Thank you so much!!
				
			
		Code:
	
	Sub copyPasteData()
  
  Dim strSourceSheet As String
  Dim strDestinationSheet As String
  Dim lastRow As Long
  
  strSourceSheet = "Data entry"
  
  Sheets(strSourceSheet).Visible = True
  Sheets(strSourceSheet).Select
  
  Range("C2").Select
  Do While ActiveCell.Value <> ""
  strDestinationSheet = ActiveCell.Value
  ActiveCell.Offset(0, -2).Resize(1, ActiveCell.CurrentRegion.Columns.Count).Select
  Selection.Copy
  Sheets(strDestinationSheet).Visible = True
  Sheets(strDestinationSheet).Select
  lastRow = LastRowInOneColumn("A")
  Cells(lastRow + 1, 1).Select
  Selection.PasteSpecial xlPasteValues
  Application.CutCopyMode = False
  Sheets(strSourceSheet).Select
  ActiveCell.Offset(0, 2).Select
  ActiveCell.Offset(1, 0).Select
  Loop
End Sub
Public Function LastRowInOneColumn(col)
  'Find the last used row in a Column: column A in this example
  'http://www.rondebruin.nl/last.htm
  Dim lastRow As Long
  With ActiveSheet
  lastRow = .Cells(.Rows.Count, col).End(xlUp).Row
  End With
  LastRowInOneColumn = lastRow
End FunctionSpecifically, my key column is Column A. That is where the rep names reside and where I need the workbook to do it's splitting. The code above uses column C, therefore this line adjust for column C:
		Code:
	
	ActiveCell.Offset(0, -2).Resize(1, ActiveCell.CurrentRegion.Columns.Count).SelectI have tried to change the offset to (0,0) but that didn't work. I am not sure how to work with this line.
I also get an error on this line, stating that it isn't defined:
		Code:
	
	Sheets(strDestinationSheet).Visible = TrueCan someone help me? I just have a spreadsheet with data in columns A: AF that needs to be split out to individual sheet tabs based on rep name, which resides in column A.
Thank you so much!!
 
	 
 
		