Hi
I am sure this is probably a quick fix but I can't get my head around the solution.
I have the following code:
What I need to do is to continue to fill down until " " (or a null value) is found within A*:D*Sheets("Export").Select Range("A3").Select ActiveCell.FormulaR1C1 = "=Import!R[7]C" ' = Date Range("B3").Select ActiveCell.FormulaR1C1 = "=Import!R[7]C&"" - ""&Import!R[4]C[1]" ' = Concatenate type & description Range("C3").Select ActiveCell.FormulaR1C1 = "=Import!R[7]C[1]" ' Debit Range("D3").Select ActiveCell.FormulaR1C1 = "=Import!R[4]C[1]" ' Credit ' Fill down to next row Range("A3:D3").Select Selection.AutoFill Destination:=Range("A3:C4"), Type:=xlFillDefault Range("A3:D4").Select
Please can anyone help me ?
Last edited by Courtneydog; 11-09-2011 at 01:48 PM. Reason: Mark as solved
Maybe:
Sub test() Dim lLR As Long With Sheets("Export") lLR = .Range("A" & .Rows.Count).End(xlUp).Row .Range("A3:A" & lLR).FormulaR1C1 = "=Import!R[4]C" ' = Date() .Range("B3:B" & lLR).FormulaR1C1 = "=Import!R[4]C&"" - ""&Import!R[4]C[1]" ' = Concatenate type & description .Range("C3:C" & lLR).FormulaR1C1 = "=Import!R[4]C[1]" ' Debit .Range("D3:D" & lLR).FormulaR1C1 = "=Import!R[4]C[1]" ' Credit End With End Sub
Regards
Thanks for that.
I am not sure why, but this only brings in the first 3 records.
Last edited by Courtneydog; 11-04-2011 at 03:58 PM.
Hi I am struggling with this question.
TMShucks gave me a solution (thank you) and after solving my own coding error (just row numbers) , I now have that bringing in the first 4 rows of data, but no more.
My (revised) vba is thus:
My problem is that the worksheet "Import" has approx 30 rows (varies) and I need to bring them all into the "Export" sheet.Sub export() Dim lLR As Long With Sheets("Export") lLR = .Range("A" & .Rows.Count).End(xlUp).Row .Range("A3:A" & lLR).FormulaR1C1 = "=Import!R[6]C" ' = Date() .Range("B3:B" & lLR).FormulaR1C1 = "=Import!R[6]C&"" - ""&Import!R[6]C[1]" ' = Concatenate type & description .Range("C3:C" & lLR).FormulaR1C1 = "=Import!R[6]C[1]" ' Debit .Range("D3:D" & lLR).FormulaR1C1 = "=Import!R[6]C[1]" ' Credit End With End Sub
Any help very much appreciated.
Last edited by Courtneydog; 11-08-2011 at 08:20 AM.
Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
To best describe or illustrate your problem you would be better off attaching a dummy workbook, the workbook should contain the same structure and some dummy data of the same type as the type you have in your real workbook - so, if a cell contains numbers & letters in this format abc-123 then that should be reflected in the dummy workbook.
If needed supply a before and after sheet in the workbook so the person helping you can see what you are trying to achieve.
Doing this will ensure you get the result you need!
Humble apologies. Rules digested.
Explanation:
I have (had) a working spreadsheet which took a csv from my bank, processed the data and prepared it for export to MS Money.
My bank have decided to separate two previously joined data streams and I now need to concatenate transaction type and description into one field. I have done this by outputting concatenated results to a second worksheet (Export)
All I need to do now, is get the Export sheet, to reflect all of the rows within the Import sheet. At present, I am only getting visibility of the first three rows.
I hope this makes sense.
I have attached the csv (as xls) from the bank (with dummy data) and my spreadsheet.
Many thanks
Please fix the Code Tags, as requested ... in both the posts with code extracts.
Thanks
Thanks for fixing the code tags.
Amended code:
Sub export() Dim lLR As Long Application.ScreenUpdating = False With Sheets("Import") lLR = .Range("A" & .Rows.Count).End(xlUp).Row End With With Sheets("Export") .Cells.ClearContents .Range("A3:A" & lLR - 4).FormulaR1C1 = "=Import!R[4]C" ' = Date() .Range("B3:B" & lLR - 4).FormulaR1C1 = "=Import!R[4]C&"" - ""&Import!R[4]C[1]" ' = Concatenate type & description .Range("C3:C" & lLR - 4).FormulaR1C1 = "=Import!R[4]C[1]" ' Debit .Range("D3:D" & lLR - 4).FormulaR1C1 = "=Import!R[4]C[1]" ' Credit End With ' SELECT RANGE FOR EXPORT TO MS MONEY Sheets("Export").Select Range("A1:D" & Range("A" & Rows.Count).End(xlUp).Row).Select Application.ScreenUpdating = True End Sub
Output:
HTML Code:26-Sep-11 Visa - SHOP £1.00 26-Sep-11 Visa - SHOP £1.00 26-Sep-11 Standing order - COMPANY £1.00 26-Sep-11 Standing order - COMPANY £1.00 27-Sep-11 Visa - SHOP £0.00 £1.00 29-Sep-11 Cheque - SHOP £1.00
The output starts in row 3; I trust this is what you want.
Regards, TMS
Fixed - many, many thanks
You're welcome.
If you are satisfied with the solution(s) provided, please mark your thread as Solved.
How to mark a thread Solved
Go to the first post
Click edit
Click Go Advanced
Just below the word Title you will see a dropdown with the word No prefix.
Change to Solved
Click Save
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks