Right now this code works perfectly to copy columns 1 and 5 from one workbook to another. However, I need to modify it so it only copies the left 8 digits of column 1(eliminating the last 2 digits) . like =LEFT(A2,8)
How would I fix this?
Thank You.
How would I fix this?
Thank You.
VBA Code:
Dim Ary As Variant
Dim Fname As String
Dim lr As Long
lr = Cells(Rows.Count, "A").End(xlUp).row
Fname = "529 A Shares Restricted Purchases violations TD " & Format(Date, "mmddyy")
Fname2 = "529ACANCEL" & Format(Date, "mmddyy")
With Workbooks(Fname & ".xlsx").Sheets("Sheet1").UsedRange
Ary = Application.Index(.Value, .Worksheet.Evaluate("row(2:" & .Rows.Count & ")"), Array(1, 5))
End With
Workbooks(Fname2 & ".csv").ActiveSheet.Range("A1").Resize(UBound(Ary), 2).Value = Ary
ActiveSheet.UsedRange.EntireColumn.AutoFit
ActiveSheet.UsedRange.EntireRow.AutoFit
Last edited by a moderator: