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

jmaejr

New Member
Joined
Mar 23, 2014
Messages
1
Sheet1

*ABCDEF
16DESCRIPTION*QUANTITYPRICEAMOUNT
17*** * * * * *- *
18*** * * * * *- *
19*** * * * * *- *
20*** * * * * *- *
21*** * * * * *- *
22*** * * * * *- *
23*** * * * * *- *
24*** * * * * *- *
25*** * * * * *- *
26*** * * * * *- *
27*** * * * * *- *
28*** * * * * *- *
29*** * * * * *- *
30*** * * * * *- *
31*** * * * * *- *
32*** * * * * *- *
33*** * * * * *- *

<tbody>
</tbody>

CALCULATIONS

*ABC
4Yellow121000
5White*258
6Silver359
7Gold*45
8Green7122
9Blue*145
10Red3522
11Purple5012

<tbody>
</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!
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.

Forum statistics

Threads
1,216,116
Messages
6,128,933
Members
449,480
Latest member
yesitisasport

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