Creatiing code to automate creating new w/sheet & copying selected data based on criteria

Werra2006

New Member
Joined
Jan 23, 2013
Messages
11
Hello all I am a complete newbie to VBA codes & I am trying to automate my spreadsheet to enable me to run my reports weekly without doing the tedious lookups & repeating the process. How it works is that I download the information from our system ie source data into the tab called detail. This worksheet starts from column B to AG. In this same worksheet my head office has legal entities (column E) for which reports have to be done separately. They are: INDL, ENV, DEFN, CONS,HALA, CIV, POL. So what I want is to create a separate report for each legal entity based on a condition that the voucher number in column P starts with SSA, SSR or MSB.

The report will be in a worksheet which I want created automatically named “CURRENT”. What I want is to copy from “DETAILS” column P into column A of “CURRENT”, B “DETAILS” into B “CURRENT”, C into C, S into D, then AB:AG into E:J Columns K & L of the “current” will need to be populated by doing a lookup of column A & return comments if any from the previous report (ie =iferror(VLOOKUP(A1,'180113'!$A$2:$L$16,12,FALSE),””).<o:p></o:p>
Points to note........data in details tab will have different rows every week & similarly the previous report. Could some geniuses crack the code and help this brother please. Thanks for your kindness.<o:p></o:p>
 
Last edited:

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Hi Werra2006,
While you are a newbie at VBA, this doesn't prevent you from useing the record function in Excel. A lot of people start off that way. Recording their actions into a macro, then doing a "step by step", function in VBA to view what the code does.
If you really want to expand your skills, def spend some time learning how to code, there are plenty of VBA books out there, but for the time being, as your functions appears to be the same action each time, a simple record and replay should do.

If you wish to view your code, and then do the step by step function.

Press alt+f11 to open the VBA editor.

Locate the code in the module (You will need to note this when you record the macro, if you're saving it to the active workbook, or your personal.xls file)

Click anywhere in the macro, and press F8

This will go through the code, step by step, and you can see what the code does.

If you have any specific questions about the code, you can ask here, or try googling first to see if you can understand the solution. Once you understand aspects of the code, it will all become clearer, and much less scary.

Good Luck.
 
Upvote 0

Forum statistics

Threads
1,215,219
Messages
6,123,678
Members
449,116
Latest member
HypnoFant

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