Hi guys, I have put together a workbook to prepare quotations for electronic systems which looks something like this (Excel 2010) it's not formatted well in this post, but in this example there are 4 columns headed "Qty", "£ Each", "Description", "Total":-
Qty £ Each Description Total
1 £1,500.00 NR1 System Controller £1,500.00
0 £ 630.50 AR Audio Router
2 £1,200.00 Audio I/P Interface £2,400.00
1 £ 929.50 P500 1 x 500 Watt £ 929.50
0 £1,103.70 P250 1 x 250 Watt
2 £1,300.00 P125 1 x 125 Watt £2,600.00
0 £1,183.00 P60 1 x 60 Watt
It is simple to select the quantity, which then calculates the total, as you can see some items are not included, but having them included in the list for selection acts as an aid de memoir to ensure the correct items are included in the overall system. I have included lots of other functions that automatically calculate the power consumption, equipment rack size, engineering time etc., dependent upon the items included. These figures appear in another tab in the workbook.
The bit I'm stuck with is this; how can I copy the selected items (values, description, £) and omit those with zero quantity to another sheet, or even Word, so that I can use this to send to the customer.
I've played around with VLOOKUP and PivotTable, but I'm not getting very far.
Hope someone can point me in the right direction.
Thanks,
Charles
Last edited by charles.turner@gmx.c; 01-12-2012 at 06:53 AM. Reason: Upload Workbook
Its better if you attach a sample workbook than copying the numbers here. Its easier to provide you a solution.
Cheers,
Arlette
If I helped, Don't forget to add to my reputation (click on the star below the post)
Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
Use code tags when posting your VBA code: [code] Your code here [/code]
Hi Arlette, worksheet now attached.
Use this code -Option Explicit Dim lrow As Long Dim i As Long Sub copy_non_zero() With Worksheets(1) .Range("D2:K2").copy Worksheets(2).Range("A1") lrow = .Range("H" & Rows.Count).End(xlUp).Row For i = 3 To lrow If .Range("D" & i).Value <> "" Then .Range("D" & i & ":K" & i).copy Worksheets(2).Range("A" & Rows.Count).End(xlUp).Offset(1, 0) End If Next i End With End Sub
Cheers,
Arlette
If I helped, Don't forget to add to my reputation (click on the star below the post)
Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
Use code tags when posting your VBA code: [code] Your code here [/code]
Thanx, that helps me alot in my project too!![]()
Last edited by bravo88; 01-12-2012 at 08:48 AM.
Charles,
You can do this using autofilter, just uncheck "blanks" and then copy/paste data to a new sheet. If you'd like a macro version:
Sub tgr() With ActiveSheet.UsedRange .AutoFilter 1, "<>" .Copy Sheets.Add.Range("A1") .AutoFilter End With End Sub
Hope that helps,
~tigeravatar
Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble
Thanks, Arlette / tigeravatar, I assume the code goes into VBA. Never used this, so I'll give it a go and keep my fingers crossed!!
Last edited by charles.turner@gmx.c; 01-12-2012 at 11:23 AM.
Tigeravatar,
Got your macro to run, couldn't get Arlette's to work!!! Probably my fault (doing something wrong).
Your macro opens a new sheet and inserts the data into it which is pretty much what I want.
Just a quick point, how do I get it to open the new sheet with the same formatting as the one it has taken the data from?
Thanks,
Charles
Give this a try:
Sub tgr() ActiveSheet.Copy Before:=Sheets(1) With ActiveSheet.UsedRange .AutoFilter 1, "=" .Offset(1).EntireRow.Delete .AutoFilter End With End Sub
Hope that helps,
~tigeravatar
Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks