VBA Skips row after checking for conditions met

FinchR

New Member
Joined
Dec 10, 2018
Messages
1
Hello,

I have a VBA script that pulls data from a transaction/order history sheet and assigns them to an individual sheet for each subject.

My problem is, as the script is running through the transaction/order history sheet and hits on the right conditions it should copy to the new sheet, it doesn't copy them to where the new sheets last entry was, it copies them in the order that they were found.
Code:
[SIZE=1]Sub BTC()[/SIZE]
[SIZE=1]Trow = 7[/SIZE]
[SIZE=1]Row = 8[/SIZE]
[SIZE=1]Ticker = "BTC"[/SIZE]
[SIZE=1]For Each Cell In Range("E8:E3000", "F8:F3000")[/SIZE]
[SIZE=1]        If Cells(Trow, "E") = "BUY" And Cells(Trow, "F") = Ticker Then[/SIZE]
[SIZE=1]        Sheet5.Cells(Row, "BF").Value = Cells(Trow, "B").Value 'date[/SIZE]
[SIZE=1]        Sheet5.Cells(Row, "BG").Value = Cells(Trow, "K").Value 'Asset Sold[/SIZE]
[SIZE=1]        Sheet5.Cells(Row, "BH").Value = Cells(Trow, "G").Value 'volume[/SIZE]
[SIZE=1]        Sheet5.Cells(Row, "BI").Value = Cells(Trow, "H").Value 'price usd[/SIZE]
[SIZE=1]        Sheet5.Cells(Row, "BJ").Value = Cells(Trow, "I").Value 'price btc[/SIZE]
[SIZE=1]        Sheet5.Cells(Row, "BK").Value = Cells(Trow, "J").Value 'price usd|btc[/SIZE]
[SIZE=1]        Sheet5.Cells(Row, "BL").Value = Cells(Trow, "X").Value 'Fee Value usd[/SIZE]
[SIZE=1]        Sheet5.Cells(Row, "BM").Value = Cells(Trow, "AB").Value 'Fee Value btc[/SIZE]
[SIZE=1]        Sheet5.Cells(Row, "BN").Value = Cells(Trow, "AF").Value 'Fee Value usd|btc[/SIZE]

[SIZE=1]        ElseIf Cell(Trow, "E") = "SELL" And Cell(Trow, "K") = Ticker Then[/SIZE]
[SIZE=1]        Sheet5.Cells(Row, "BF").Value = Cells(Trow, "B").Value 'date[/SIZE]
[SIZE=1]        Sheet5.Cells(Row, "BG").Value = Cells(Trow, "F").Value 'Asset Sold[/SIZE]
[SIZE=1]        Sheet5.Cells(Row, "BH").Value = Cells(Trow, "L").Value 'volume[/SIZE]
[SIZE=1]        Sheet5.Cells(Row, "BI").Value = Cells(Trow, "H").Value 'price usd[/SIZE]
[SIZE=1]        Sheet5.Cells(Row, "BJ").Value = Cells(Trow, "I").Value 'price btc[/SIZE]
[SIZE=1]        Sheet5.Cells(Row, "BK").Value = Cells(Trow, "J").Value 'price usd|btc[/SIZE]
[SIZE=1]        Sheet5.Cells(Row, "BL").Value = Cells(Trow, "X").Value 'Fee Value usd[/SIZE]
[SIZE=1]        Sheet5.Cells(Row, "BM").Value = Cells(Trow, "AB").Value 'Fee Value btc[/SIZE]
[SIZE=1]        Sheet5.Cells(Row, "BN").Value = Cells(Trow, "AF").Value 'Fee Value usd|btc[/SIZE]

[SIZE=1]        End If[/SIZE]
[SIZE=1]        Row = Row + 1[/SIZE]
[SIZE=1]        Trow = Row + 1[/SIZE]

[SIZE=1]    Next Cell[/SIZE]

Any help with this would be awesome and thank you in advance
 
Last edited by a moderator:

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Cross posted https://www.excelforum.com/excel-pr...ased-on-conditions-being-met.html#post5024749

While we do not prohibit Cross-Posting on this site, we do ask that you please mention you are doing so and provide links in each of the threads pointing to the other thread (see rule 13 here along with the explanation: Forum Rules).
This way, other members can see what has already been done in regards to a question, and do not waste time working on a question that may already be answered.
 
Upvote 0

Forum statistics

Threads
1,214,588
Messages
6,120,412
Members
448,960
Latest member
AKSMITH

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