VBA: Copy Multiple Cells to another worksheet if not equal to 0

jmaejr

New Member
Joined
Mar 23, 2014
Messages
1
Sheet1

*ABCDEF
**
**
**
**
**
**
**
**
**
**
**
**
**
**
**
**
**

<tbody>
[TD="bgcolor: #cacaca, align: center"]16[/TD]
[TD="bgcolor: #969696, colspan: 2, align: left"]DESCRIPTION[/TD]
[TD="bgcolor: #969696"]*[/TD]
[TD="bgcolor: #969696, align: center"]QUANTITY[/TD]
[TD="bgcolor: #969696, align: center"]PRICE[/TD]
[TD="bgcolor: #969696, align: center"]AMOUNT[/TD]

[TD="bgcolor: #cacaca, align: center"]17[/TD]
[TD="colspan: 3"]*[/TD]

[TD="align: right"] * * * * *- *[/TD]

[TD="bgcolor: #cacaca, align: center"]18[/TD]
[TD="colspan: 3"]*[/TD]

[TD="align: right"] * * * * *- *[/TD]

[TD="bgcolor: #cacaca, align: center"]19[/TD]
[TD="colspan: 3"]*[/TD]

[TD="align: right"] * * * * *- *[/TD]

[TD="bgcolor: #cacaca, align: center"]20[/TD]
[TD="colspan: 3"]*[/TD]

[TD="align: right"] * * * * *- *[/TD]

[TD="bgcolor: #cacaca, align: center"]21[/TD]
[TD="colspan: 3"]*[/TD]

[TD="align: right"] * * * * *- *[/TD]

[TD="bgcolor: #cacaca, align: center"]22[/TD]
[TD="colspan: 3"]*[/TD]

[TD="align: right"] * * * * *- *[/TD]

[TD="bgcolor: #cacaca, align: center"]23[/TD]
[TD="colspan: 3"]*[/TD]

[TD="align: right"] * * * * *- *[/TD]

[TD="bgcolor: #cacaca, align: center"]24[/TD]
[TD="colspan: 3"]*[/TD]

[TD="align: right"] * * * * *- *[/TD]

[TD="bgcolor: #cacaca, align: center"]25[/TD]
[TD="colspan: 3"]*[/TD]

[TD="align: right"] * * * * *- *[/TD]

[TD="bgcolor: #cacaca, align: center"]26[/TD]
[TD="colspan: 3"]*[/TD]

[TD="align: right"] * * * * *- *[/TD]

[TD="bgcolor: #cacaca, align: center"]27[/TD]
[TD="colspan: 3"]*[/TD]

[TD="align: right"] * * * * *- *[/TD]

[TD="bgcolor: #cacaca, align: center"]28[/TD]
[TD="colspan: 3"]*[/TD]

[TD="align: right"] * * * * *- *[/TD]

[TD="bgcolor: #cacaca, align: center"]29[/TD]
[TD="colspan: 3"]*[/TD]

[TD="align: right"] * * * * *- *[/TD]

[TD="bgcolor: #cacaca, align: center"]30[/TD]
[TD="colspan: 3"]*[/TD]

[TD="align: right"] * * * * *- *[/TD]

[TD="bgcolor: #cacaca, align: center"]31[/TD]
[TD="colspan: 3"]*[/TD]

[TD="align: right"] * * * * *- *[/TD]

[TD="bgcolor: #cacaca, align: center"]32[/TD]
[TD="colspan: 3"]*[/TD]

[TD="align: right"] * * * * *- *[/TD]

[TD="bgcolor: #cacaca, align: center"]33[/TD]
[TD="colspan: 3"]*[/TD]

[TD="align: right"] * * * * *- *[/TD]

</tbody>

CALCULATIONS

*ABC
Yellow
White*
Silver
Gold*
Green
Blue*
Red
Purple

<tbody>
[TD="bgcolor: #cacaca, align: center"]4[/TD]

[TD="align: right"]12[/TD]
[TD="align: right"]1000[/TD]

[TD="bgcolor: #cacaca, align: center"]5[/TD]

[TD="align: right"]258[/TD]

[TD="bgcolor: #cacaca, align: center"]6[/TD]

[TD="align: right"]3[/TD]
[TD="align: right"]59[/TD]

[TD="bgcolor: #cacaca, align: center"]7[/TD]

[TD="align: right"]45[/TD]

[TD="bgcolor: #cacaca, align: center"]8[/TD]

[TD="align: right"]7[/TD]
[TD="align: right"]122[/TD]

[TD="bgcolor: #cacaca, align: center"]9[/TD]

[TD="align: right"]145[/TD]

[TD="bgcolor: #cacaca, align: center"]10[/TD]

[TD="align: right"]3[/TD]
[TD="align: right"]522[/TD]

[TD="bgcolor: #cacaca, align: center"]11[/TD]

[TD="align: right"]50[/TD]
[TD="align: right"]12[/TD]

</tbody>


Hi, After searching multiple treads on this I have come up with a partial solution. Excel 2013.

I want to copy the cells consisting of the description, quantity and price to the corresponding columns in 'Sheet1' (which will be named 'PROPOSAL') from the 'CALCULATIONS' sheet. I have used a Macro that I found and tweaked it to move the data to 'Sheet1', however it puts the data in Column A, Row 2 every time...I need it to be placed into the corresponding columns, starting with Column A, Row X and so forth...in 'Sheet1' Columns A,B,C are merged.

Here is my VB code:

Sub BuildProposal()

Dim Src As Worksheet, Dest As Worksheet
Dim n As Integer, i As Integer, c As Integer

Set Src = Sheets("CALCULATIONS")
Set Dest = Sheets("PROPOSAL")

With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
.EnableEvents = False
End With

For i = 1 To Src.Range("B" & Rows.Count).End(xlUp).Row
If Src.Range("B" & i).Value <> 0 Then

n = Dest.Range("A" & Rows.Count).End(xlUp).Row + 1
Dest.Range("A" & n).Value = Src.Cells(i, 1).Value

n = Dest.Range("A" & Rows.Count).End(xlUp).Row
Dest.Range("B" & n).Value = Src.Cells(i, 2).Value

n = Dest.Range("A" & Rows.Count).End(xlUp).Row
Dest.Range("C" & n).Value = Src.Cells(i, 3).Value

End If

Next i

With Application
.ScreenUpdating = True
.EnableEvents = True
.Calculation = CalcMode
End With

End Sub

Any help is greatly appreciated.

Thanks!
 

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top