alan myers
Board Regular
- Joined
- Oct 31, 2017
- Messages
- 119
- Office Version
- 365
- Platform
- Windows
VBA Code:
Sub CopyTranspose()
Dim rowPay As Long, colPay As Long, rowComb As Long
Dim nCarrier As Long, irowComb As Long, icolPay As Long
Dim rngCopy As Range, rngPaste As Range
Dim wb As Workbook
Dim wsPayroll As Worksheet, wsCombine As Worksheet
Set wb = ActiveWorkbook
Set wsPayroll = wb.Sheets("Payroll")
Set wsCombine = wb.Sheets("Combine")
Application.ScreenUpdating = False
' Get next empty row
rowPay = wsPayroll.Cells(Rows.Count, "C").End(xlUp).Offset(1).Row
' Initital column in wsPayroll
icolPay = 3
' Initital row on wsCombine
irowComb = 3
For nCarrier = 0 To 194
colPay = icolPay + (nCarrier * 11)
rowComb = irowComb + (nCarrier * 12)
Set rngCopy = wsCombine.Range("B" & rowComb).Resize(10, 1)
Set rngPaste = wsPayroll.Cells(rowPay, colPay)
rngPaste.Resize(1, rngCopy.Rows.Count) = Application.WorksheetFunction.Transpose(rngCopy.Value)
Next
End Sub
https://www.mediafire.com/file/bbx1vzl6ccuepzf/Payroll+v3.xlsm/file my file
before this code is run I need to check the payroll tab to find the next empty row then check that rows date in column a if it matches today's date then run the code else end
like to and this code to the start of my code
Last edited by a moderator: