VBA Help

nanderson

New Member
Joined
Feb 11, 2021
Messages
2
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
I have a sheet that has a list of employees and devices assigned to those employees. I would like to put each employee and their devices on a separate tab in an excel workbook. So at each change in employee name, copy that data over to a tab and then name that tab by that employee's name.

I have a short timeline to get this done so any information would be helpful.
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
something like this to get you started.
alter the employee name column to yours.
run: ParseEmp2Sheets

Code:
Sub ParseEmp2Sheets()
Dim wsSrc As Worksheet
Dim vEmp
Dim r As Long

Set wsSrc = ActiveSheet
Range("A2").Select
While ActiveCell.Value <> ""
vEmp = ActiveCell.Value
r = ActiveCell.Row
Rows(r & ":" & r).Copy

makeEmp vEmp
wsSrc.Activate 'back to source

ActiveCell.Offset(1, 0).Select 'next row
Wend

Set wsSrc = Nothing
End Sub

Private Sub makeEmp(ByVal pvName)
On Error GoTo errMake
Sheets(pvName).Activate
ActiveCell.Offset(1, 0).Select 'next row
ActiveSheet.Paste
Application.CutCopyMode = False
Exit Sub
errMake:
Sheets.Add
ActiveSheet.Name = pvName
Resume Next
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,063
Messages
6,122,935
Members
449,094
Latest member
teemeren

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top