Module to find & move based on cell adjacent's set value

bradnailer

New Member
Joined
Jul 27, 2007
Messages
26
ABCDE
FGHIJK


If the above is in different cells, I want to be able to move the data in "G" to the cell beside "E" (up a row and over 4 columns) IF the cell to the left of "G" equals what I specify is in "F" (for example use "product"). I would want to apply this to an entire sheet, not just once. If the macro (not sure what its called) could also then delete the row that contained "G" after it moves it, that would be even better!!! The output in the example above would be:

ABCDEG
F HIJK <----then this row gets deleted

So essentially, whenever the macro comes across the value "product" it move the data in the cell adjacent to it up a row and over 4 columns and then the row it came from is deleted.


I've looked and searched but haven't seen anything that I may be able to copy (I'm not a VBA expert so I'm not sure how to write something myself)

Thanks!!
 
I would not consider the code here as beginner code. At least for me. I have spend 4 years on this excel forum gleaning ideas from those that post suggestions. There are some excellent people here that seem to code VBA in their sleep. I am not one of them.
As far as learning from books or classes, I have learned more just working with problems that are posted here than anything else.
 
Upvote 0

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
YES!, YES!, YES!!! I think that is it!!!!!!!!! You wouldn't believe the hours I've spent searching around on how to do that!!!! Thanks so much!!.

How do I make this macro available to other sheets that I open or create? - to me it looks that I save it to the current sheet I'm using and I have to have that sheet open to access it? Is that how macros work?

This has made me want to learn VBA so that I can help others!!!
 
Upvote 0
Glad it worked out for you.

How do I make this macro available to other sheets that I open or create?
Save the code in a Standard Module, it will be available to all sheets on that workbook.
If you want code to be available to any workbook you open, you would save it in the "Personal.xls" workbook. For more information on Personal.xls, do a search on this forum using that text. You will receive a number of hits that explain its' usage.
 
Upvote 0

Forum statistics

Threads
1,215,029
Messages
6,122,755
Members
449,094
Latest member
dsharae57

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