Hi,
Vendor spreadsheet with the following fields:
VendorID Vendor Name and Amount
is it possible to import a csv file that will import the amounts to match vendor using the VendorID, I use the code below to import others but no sure it can be modify to process the above.
this to do list of accruals meaning if there's no amount the vendor with zero amount will be the one to accrue.
here is the code if possible to modify:
thank you.
Vendor spreadsheet with the following fields:
VendorID Vendor Name and Amount
is it possible to import a csv file that will import the amounts to match vendor using the VendorID, I use the code below to import others but no sure it can be modify to process the above.
this to do list of accruals meaning if there's no amount the vendor with zero amount will be the one to accrue.
here is the code if possible to modify:
VBA Code:
Sub ImportRawData()
Dim c As Long
Dim Col As Variant
Dim Filename As String
Dim Filepath As Variant
Dim rngBeg As Range
Dim rngEnd As Range
Dim rngDst As Range
Dim rngSrc As Range
Dim rowsize As Long
Dim wkbDst As Workbook
Dim wkbSrc As Workbook
Dim vFile
vFile = Application.GetOpenFilename("CSV Files(*.csv),*.csv", , "please select a file", MultiSelect:=False)
Set wkbDst = ThisWorkbook
Set rngDst = wkbDst.Worksheets("EFT Summary").Range("A5:H5")
Filepath = "C:\Users\jose.rossi\Desktop\NCL EFT_Summary.xlsm"
Filename = "apcbtclz.csv"
On Error Resume Next
Set wkbSrc = Workbooks(Filename)
If Err = 9 Then
If Filepath <> "" Then ChDir Filepath Else ChDir ThisWorkbook.Path
'Filename = Application.GetOpenFilename("Excel Workbooks, *.xlsx")
If Filename = "False" Then Exit Sub
Set wkbSrc = Workbooks.Open(Filename)
End If
On Error GoTo 0
' Clear previous data.
'rngDst.Resize(rngDst.Parent.UsedRange.Rows.Count).ClearContents
' Import the data.
With wkbSrc.Worksheets("apcbtclz").UsedRange
' Step through the source data columns.
For Each Col In Array("AW", "BO", "BB", "AX", "X", "CH")
' Data starts on row 1.
Set rngBeg = .Parent.Cells(1, Col)
' Find the row where the data ends in this column.
Set rngEnd = .Parent.Cells(Rows.Count, Col).End(xlUp)
' Number of rows in this column.
rowsize = rngEnd.Row '- rngBeg.Row
If rowsize > 0 Then
Set rngSrc = .Parent.Range(rngBeg, rngEnd)
rngDst.Offset(0, c).Resize(rowsize, 1).Value = rngSrc.Value
End If
' Increment the column offset.
c = c + 1
If c = 6 Then Let c = 7
Next Col
End With
End Sub
thank you.