Need to edge out the competition for your dream job? Train for certifications today.
Experts Exchange Solution brought to you by
"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.
Dim sws As Worksheet, dws As Worksheet
Dim lr1 As Long, lc As Long, lr2 As Long, dlr As Long
Dim rng As Range, rngList As Range, cell As Range
Application.ScreenUpdating = False
Set sws = Sheets("List")
lr1 = sws.Cells(Rows.Count, 2).End(xlUp).Row
lr2 = sws.Cells(Rows.Count, 4).End(xlUp).Row
lc = sws.Cells(3, Columns.Count).End(xlToLeft).Column
Set rng = sws.Range(sws.Cells(4, 4), sws.Cells(lr2, lc))
Set rngList = sws.Range("B4:B" & lr1)
On Error Resume Next
Set dws = Sheets("Master")
On Error GoTo 0
If dws Is Nothing Then
Set dws = Sheets.Add(after:=sws)
dws.Name = "Master"
sws.Range("D3", sws.Range("D3").End(xlToRight)).Copy dws.Range("B1")
dws.Range("A1").Value = "Name"
For Each cell In rngList
dlr = dws.Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row + 1
rng.Copy dws.Range("B" & dlr)
dws.Range("A" & dlr).Value = cell.Value
dlr = dws.Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
dws.Range("A2:A" & dlr).SpecialCells(xlCellTypeBlanks).Formula = "=R[-1]C"
dws.Range("A2:A" & dlr).Value = dws.Range("A2:A" & dlr).Value
dws.Range("A1").CurrentRegion.Borders.Color = vbBlack
Application.ScreenUpdating = True
Open in new window
Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.
Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.
From novice to tech pro — start learning today.
Premium members can enroll in this course at no extra cost.
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
Please enter a first name
Please enter a last name
Must be at least 4 characters long.
Join and Comment