View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Claus Busch Claus Busch is offline
external usenet poster
 
Posts: 3,872
Default Convert visa pdf statements to three columns in excel?

Hi Imogen,

Am Tue, 15 Dec 2015 23:16:49 -0800 (PST) schrieb imogen b:

12/08/15
Company A
$10
12/11/15
Company B
$20
12/14/15
Company C
$30

Instead of like this (in three columns):

12/08/15 Company A $10
12/11/15 Company B $20
12/14/15 Company C $30


try following macro in a copy of your sheet:

Sub PDFtoExcel()
Dim varData As Variant, varOut() As Variant
Dim LRow As Long, i As Long, j As Long, n As Long

With Sheets("Sheet1")
LRow = .Cells(Rows.Count, 1).End(xlUp).Row
varData = .Range("A1:A" & LRow)
ReDim Preserve varOut(UBound(varData) / 3 - 1, 2)
For i = LBound(varData) To UBound(varData) Step 3
For j = 0 To 2
varOut(n, j) = varData(i + j, 1)
Next j
n = n + 1
Next i
.Range("A1:A" & LRow).ClearContents
.Range("A1").Resize(UBound(varOut) + 1, 3) = varOut
End With
End Sub


Regards
Claus B.
--
Vista Ultimate / Windows7
Office 2007 Ultimate / 2010 Professional