Need a macro between documents for business use!

Kanger14

New Member
Joined
Jan 27, 2020
Messages
12
Office Version
  1. 365
Platform
  1. Windows
Hello everyone,

I am looking for assistance in building a more efficient macro for my business use between two documents.

So for simplicity sake, I will call the two documents Data and Work.

Document Data is where we pull our raw data from, hence the name of the file will change daily.
Document Work is what we use to put that raw data in, and make accessible for our staff to work off of.


For Document Data:

The first thing that we need to do is select all columns and autofit column width.
Then we need to delete, in this order, columns A to G, columns B to C, columns D to V, column F, and then columns G to AD. For each deletion, we naturally need the non cleared columns to slide as far left as they can.

This is what I have for this section, though unsure if its the most efficient/effective:

Columns("A:G").Select
Selection.Delete Shift:=xlToLeft
Columns("B:C").Select
Selection.Delete Shift:=xlToLeft
Columns("D:V").Select
Selection.Delete Shift:=xlToLeft
Columns("F:F").Select
Selection.Delete Shift:=xlToLeft
Columns("G:AD").Select
Selection.Delete Shift:=xlToLeft

Once this is done, we need to set up filters on columns A B and C.
Column A needs to be filtered from newest date to oldest.
Columns B and C need to be filtered to only show only "TRUE".


So up to this point I have been able to create to some degree... but this next part is where I am clueless.


Now what we need to do is go to Document Work, and look at the email address in row 2. What we need to happen now is to take that email address, find it in Document Data, and delete all rows beneath it.
Then we need to take all the remaining rows in Document Data (everything above the found email address, and insert them above row 2 in Document Work.



The last thing I will mention is that Document Work is a shared sheet, whereas Document Data is not and can have a macro added. We have the ability to completely restart Document Work in order to add a macro, and then share it again.

If anyone has a macro they think could fit this need, I am all ears!

Thank you!
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
See if this helps ?
Once this is done, we need to set up filters on columns A B and C.
Column A needs to be filtered from newest date to oldest.
Columns B and C need to be filtered to only show only "TRUE".
VBA Code:
  ActiveSheet.AutoFilterMode = False 'Clear filter
  ActiveSheet.UsedRange.Sort _
    key1:=Range("A:A"), order1:=xlAscending
  ActiveSheet.UsedRange.AutoFilter Field:=2, Criteria1:=True
  ActiveSheet.UsedRange.AutoFilter Field:=3, Criteria1:=True
 
Upvote 0

Forum statistics

Threads
1,214,990
Messages
6,122,625
Members
449,093
Latest member
catterz66

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