vba for vlookup to paste info onto next line down in next open cell in new workbook

Saoirse

New Member
Joined
Jan 27, 2022
Messages
33
Office Version
  1. 365
Platform
  1. Windows
Trying to copy with a vlookup info from the list from workbook "Shrinkage" sheet "Friday" then paste it onto workbook "Productivity tracker" sheet "Allie" on the next row down in columns Y:AD.

here afre the macros i keep trying but neither one seems to pull the info the paste onto the "Allie" spreadsheet on the next line down starting on column Y.
Sub shrinkpull()

Dim NextRow As Integer

NextRow = sheets("Allie").Cells(Rows.Count, 23).End(xlUp).Row + 1

sheets("Allie").Range("Y" & NextRow) = Workbooks("Shrinkage.xlsx").Worksheets("Monday").Range("C4:H4").copy _
("Productivity Tracker.xlsm").Worksheets("Allie").Range("Y & NextRow")

End Sub
Sub vlook()
'
Dim NextRow As Integer

NextRow = sheets("Allie").Cells(Rows.Count, 23).End(xlUp).Row + 1
'
Sheets("Allie").Range("Y" & NextRow)= WorksheetFunction.VLOOKUP([Shrinkage.xlsm](sheets("Friday").Range ("A4"),[Shrinkage.xlsm]sheets("Friday").Range("A3:H32"), 3,FALSE))


End Sub


Shrinkage.xlsm
ACDEFGH
1Enter the minutes worked for each category. EX: 1 hour = 60; 2 hours = 120ComplianceSystem issuesFrontierLetters / Special projects Call pulls, fee calculations, large casesbuzz, trianing, coaching
2
3Alexis
4Allie 601080452030
5Aaron
6 Breonna
Friday


Productivity Tracker.xlsm
ABCDIJMNSTUVWXYZAAABACAD
2DateAdjustments madePrep Cases WorkedTimeDenial ClosuresTimeACETimeApproved ClosureTimeWorldpay SettlementsTimeTotal Minutes Worked % time working casesComplianceSystem issuesFrontierLetters / Special ProjectsCall pulls / fee calculations / large casesbuzz, trianing, coaching
32/1/2022462721617 0114472128864%601080452030
42/2/202236118853551528133918541%
52/3/2022482161611213176892722647%
62/6/202218216321 01040398618%
Allie
Cell Formulas
RangeFormula
W3:W6W3=SUM(D3+J3+N3+T3+V3)
X3:X4X3=W3/450
Y3Y3=VLOOKUP('Z:\Departmental Shares\dOps\POC Training Material\Intake\Lesli Johnson\[Shrinkage.xlsm]Friday'!$A$4,'Z:\Departmental Shares\dOps\POC Training Material\Intake\Lesli Johnson\[Shrinkage.xlsm]Friday'!A$3:H$32,3,FALSE)
Z3Z3=VLOOKUP('Z:\Departmental Shares\dOps\POC Training Material\Intake\Lesli Johnson\[Shrinkage.xlsm]Friday'!$A$4,'Z:\Departmental Shares\dOps\POC Training Material\Intake\Lesli Johnson\[Shrinkage.xlsm]Friday'!A$2:H$32,4,FALSE)
AA3AA3=VLOOKUP('Z:\Departmental Shares\dOps\POC Training Material\Intake\Lesli Johnson\[Shrinkage.xlsm]Friday'!$A$4,'Z:\Departmental Shares\dOps\POC Training Material\Intake\Lesli Johnson\[Shrinkage.xlsm]Friday'!A$3:H$32,5,FALSE)
AB3AB3=VLOOKUP('Z:\Departmental Shares\dOps\POC Training Material\Intake\Lesli Johnson\[Shrinkage.xlsm]Friday'!$A$4,'Z:\Departmental Shares\dOps\POC Training Material\Intake\Lesli Johnson\[Shrinkage.xlsm]Friday'!A$3:H$32,6,FALSE)
AC3AC3=VLOOKUP('Z:\Departmental Shares\dOps\POC Training Material\Intake\Lesli Johnson\[Shrinkage.xlsm]Friday'!$A$4,'Z:\Departmental Shares\dOps\POC Training Material\Intake\Lesli Johnson\[Shrinkage.xlsm]Friday'!A$3:H$32,7,FALSE)
AD3AD3=VLOOKUP('Z:\Departmental Shares\dOps\POC Training Material\Intake\Lesli Johnson\[Shrinkage.xlsm]Friday'!$A$4,'Z:\Departmental Shares\dOps\POC Training Material\Intake\Lesli Johnson\[Shrinkage.xlsm]Friday'!A$3:H$32,8,FALSE)
X5:X6X5=W5/480
I3:I6,S3:S6I3=SUM(E3:H3)
M3:M6M3=SUM(K3:L3)
 
Your comment helped.
Not sure if it is because I don't have EVERY employee tab filled in on the productivity tracker or not. But that could be it.

I wrapped the section to look up the person inside an if statement to ignore persons who don't have the Input Date on their sheet.
Get rid of the lines with dashed it was just to try to highlight that I had wrapped the previous section inside the if statement.

VBA Code:
                '--------------------------------------------------------------------------------------------------------
                ' Do the next section only if date found for Person                 ' <--- New line added (1 of 3)
                If prdRowNo <> 0 Then                                               ' <--- New line added (2 of 3)
                '--------------------------------------------------------------------------------------------------------
                    ' Find Person's Name in Shrinkage sheet for the day of the week matching the input date
                    If Not IsError(Application.Match(persName, rngShkName, 0)) Then
                        shkPersRow = Application.Match(persName, rngShkName, 0)
                      
                            Set rngShkPers = shtShkDay.Range("C" & shkPersRow & ":H" & shkPersRow)
                            shtProd.Range("Y" & prdRowNo).Resize(, rngShkPers.Columns.Count).Value = rngShkPers.Value
                    Else
                            ' Remove this if it is a common occurence for people not being on the Shrinkage sheet
                            MsgBox persName & " Not found on " & dtCellDay
                    End If
                '--------------------------------------------------------------------------------------------------------
                End If                                                                ' <--- New line added (3 of 3)
 
Upvote 0

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
This works beautifully!! Thank you so much again for all your help!! I appreciate it more than you know!
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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