By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,631 Members | 1,345 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,631 IT Pros & Developers. It's quick & easy.

Dynamically Shifting rows within a spreadsheet using VB

P: 2
Good afternoon all,

I'm new to vb and I'm having a problem with a user request. I have created a macro that builds a spreadsheet that I need to manipulate a little bit. For every record in the worksheet that has revenue (column f) = zero, I need to move that record (row) to the bottom. I want to do this for every record that meets that criteria.

I have the following code (which I believe works) to select and cut the data I need; it's the moving and shifting of the data that I'm stuck on:

' Select records with ZERO revenue and move them to the end
raddr = "a2:j"
Range("f:f").Select
Selection.AutoFilter Field:=1, Criteria1:="0.00"
Selection.SpecialCells(xlCellTypeLastCell).Select
xrow = ActiveCell.Row
raddr = raddr + xrow
Range(raddr).Select
Selection.Cut
Selection.AutoFilter

What is the easiest way to accomplish this? Thanks VERY MUCH for your help!

mikechance812
Mar 22 '07 #1
Share this Question
Share on Google+
1 Reply


P: 2
Can an expert in using Visual Basic with EXCEL please respond to my programming question? I really need some assistance.

Thank you!


Good afternoon all,

I'm new to vb and I'm having a problem with a user request. I have created a macro that builds a spreadsheet that I need to manipulate a little bit. For every record in the worksheet that has revenue (column f) = zero, I need to move that record (row) to the bottom. I want to do this for every record that meets that criteria.

I have the following code (which I believe works) to select and cut the data I need; it's the moving and shifting of the data that I'm stuck on:

' Select records with ZERO revenue and move them to the end
raddr = "a2:j"
Range("f:f").Select
Selection.AutoFilter Field:=1, Criteria1:="0.00"
Selection.SpecialCells(xlCellTypeLastCell).Select
xrow = ActiveCell.Row
raddr = raddr + xrow
Range(raddr).Select
Selection.Cut
Selection.AutoFilter

What is the easiest way to accomplish this? Thanks VERY MUCH for your help!

mikechance812
Mar 26 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.