Help with Macro (new to macro's)

%3CLINGO-SUB%20id%3D%22lingo-sub-1241136%22%20slang%3D%22en-US%22%3EHelp%20with%20Macro%20(new%20to%20macro's)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1241136%22%20slang%3D%22en-US%22%3E%3CP%3ENew%20to%20recording%20macro's%20and%20I'm%20a%20little%20stuck%20so%20after%20a%20bit%20of%20help%20please.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI'm%20trying%20to%20record%20a%20macro%20that%20will%20filter%20data%20on%20one%20sheet%2C%20copy%20the%20results%20(but%20not%20the%20headings)%26nbsp%3Band%20then%20paste%20them%20in%20the%20first%20empty%20row%20in%20a%20different%20workbook.%20I%20want%20to%20be%20able%20to%20run%20this%20each%20day%20and%20the%20data%20continue%20to%20paste%20in%20the%20first%20empty%20row%20on%20the%20workbook.%20I'd%20imagine%20this%20is%20very%20basic%20but%20I%20just%20can't%20get%20the%20data%20to%20paste%20into%20the%20empty%20row%20each%20time.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1241136%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EMacros%20and%20VBA%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1245264%22%20slang%3D%22en-US%22%3ERe%3A%20Help%20with%20Macro%20(new%20to%20macro's)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1245264%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F588158%22%20target%3D%22_blank%22%3E%40Sully_78%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI'm%20not%20a%20macro%20person%2C%20so%20if%20you're%20absolutely%20committed%20to%20doing%20this%2C%20you're%20going%20to%20have%20to%20wait%20for%20somebody%20else%20to%20come%20along.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBut%20I%20did%20want%20to%20chime%20in%20just%20to%20say%20that%20macros%20and%20Visual%20Basic%20routines%20are%20often%20overrated.%20I%20say%20that%20because%20the%20built%20in%20functions%20of%20Excel%20have%20continually%20been%20extended%20over%20the%20years%2C%20often%20now%20able%20to%20do%20things%20that%20required%20macros%2FVBA%20in%20the%20olden%20days.%20I%20know%20there%20are%20other%20%22experts%22%20here%20at%20this%20site%20who%20work%20first%20to%20find%20a%20non-macro%20solution%20if%20it's%20at%20all%20possible.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESo%20if%20you%20don't%20mind%20describing%20the%20actual%20situation%20a%20bit%20more%2C%20or%20letting%20us%20know%20that%20you've%20tried--say--the%20FILTER%20function%20and%20found%20it%20wanting%20for%20this%20or%20that%20reason%2C%20it's%20conceivable%20that%20somebody%20here%20might%20be%20able%20to%20help%20you%20find%20a%20different%20solution.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIf%20you're%20just%20wanting%20to%20learn%20how%20to%20write%20a%20macro...go%20for%20it%2C%20and%20feel%20free%20to%20ignore%20my%20comments.%20%3CLI-EMOJI%20id%3D%22lia_slightly-smiling-face%22%20title%3D%22%3Aslightly_smiling_face%3A%22%3E%3C%2FLI-EMOJI%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1245980%22%20slang%3D%22en-US%22%3ERe%3A%20Help%20with%20Macro%20(new%20to%20macro's)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1245980%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F588158%22%20target%3D%22_blank%22%3E%40Sully_78%3C%2FA%3E%26nbsp%3BAssuming%20you%20have%20the%20Developer%20tab%20active%20and%20you%20know%20how%20to%20record%20a%20macro%2C%20and%20how%20to%20get%20the%20Module%20where%20the%20macro%20gets%20recorded!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EStart%20by%20recording%20all%20the%20steps%20that%20you%20want%20to%20automate.%20This%20will%20result%20in%20very%20crude%20VBA%20code%2C%20probably%20containing%20a%20lot%20of%20useless%20bits%20of%20code%20due%20to%20scrolling%2C%20selecting%20a%20wrong%20cell%2C%20jumping%20to%20another%2C%20doing%20nothing%20and%20then%20selecting%20yet%20another%20cell%20etc.%20The%20recorder%20literally%20registers%20every%20single%20step%20you%20take%2C%20including%20all%20your%20mistakes.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThen%20get%20rid%20of%20all%20this%20garbage%20code%20and%20see%20if%20you%20can%20still%20run%20the%20macro.%20If%20there%20is%20still%20too%20much%20clutter%2C%20or%20the%20macro%20crashes%2C%20just%20scrap%20it%20and%20start%20all%20over%2C%20trying%20to%20make%20less%20mistakes.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENext%20would%20be%20to%20Google%20around%20to%20find%20the%20bits%20of%20code%20you%20need%20to%20select%20and%20filter%20ranges%20based%20on%20logical%20rules%20rather%20than%20by%20cell%20references.%20The%20recorder%20will%20have%20created%20code%20that%20e.g.%20goes%20to%20Sheet1%2C%20Selects%20the%20Range%20%24A%242%3A%24H%24300%2C%20copy%20it%20and%20paste%20in%20Sheet2%20starting%20at%20row%20510.%20You%20need%20to%20get%20rid%20of%20these%20absolute%20cell%20references%2C%20because%20next%20time%20the%20data%20to%20be%20copied%20sits%20in%20range%20A2%3AH800%20or%20A2%3AH123.%20And%20then%20perhaps%20you%20want%20to%20paste%20it%20downwards%20from%20row%201025%20(not%20510)%2C%20being%20the%20next%20empty%20row%20at%20that%20time.%26nbsp%3BAll%20doable%20and%20not%20very%20difficult.%20But%20if%20you%20need%20help%20from%20someone%20here%20you%20would%20have%20to%20upload%20and%20example%20of%20your%20workbook.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Occasional Visitor

New to recording macro's and I'm a little stuck so after a bit of help please.

 

I'm trying to record a macro that will filter data on one sheet, copy the results (but not the headings) and then paste them in the first empty row in a different workbook. I want to be able to run this each day and the data continue to paste in the first empty row on the workbook. I'd imagine this is very basic but I just can't get the data to paste into the empty row each time.

2 Replies
Highlighted

@Sully_78 

 

I'm not a macro person, so if you're absolutely committed to doing this, you're going to have to wait for somebody else to come along.

 

But I did want to chime in just to say that macros and Visual Basic routines are often overrated. I say that because the built in functions of Excel have continually been extended over the years, often now able to do things that required macros/VBA in the olden days. I know there are other "experts" here at this site who work first to find a non-macro solution if it's at all possible.

 

So if you don't mind describing the actual situation a bit more, or letting us know that you've tried--say--the FILTER function and found it wanting for this or that reason, it's conceivable that somebody here might be able to help you find a different solution.

 

If you're just wanting to learn how to write a macro...go for it, and feel free to ignore my comments.

Highlighted

@Sully_78 Assuming you have the Developer tab active and you know how to record a macro, and how to get the Module where the macro gets recorded!

 

Start by recording all the steps that you want to automate. This will result in very crude VBA code, probably containing a lot of useless bits of code due to scrolling, selecting a wrong cell, jumping to another, doing nothing and then selecting yet another cell etc. The recorder literally registers every single step you take, including all your mistakes.

 

Then get rid of all this garbage code and see if you can still run the macro. If there is still too much clutter, or the macro crashes, just scrap it and start all over, trying to make less mistakes.

 

Next would be to Google around to find the bits of code you need to select and filter ranges based on logical rules rather than by cell references. The recorder will have created code that e.g. goes to Sheet1, Selects the Range $A$2:$H$300, copy it and paste in Sheet2 starting at row 510. You need to get rid of these absolute cell references, because next time the data to be copied sits in range A2:H800 or A2:H123. And then perhaps you want to paste it downwards from row 1025 (not 510), being the next empty row at that time. All doable and not very difficult. But if you need help from someone here you would have to upload and example of your workbook.