If I need to automate a series a task on an excel sheet like
remove all rows where column 3 contains value "asdf"
remove column 7 and column 9
sort according to column 4
etc.
What is the easiest way of automating such tasks in excel? I think it would recording a macro but sometimes macro have to be edited a lot to actually make them work and even then macros stop if the excel sheet has a variation. Editing macro scripts could be a time taking process which becomes inefficient for such tasks. The automation is required since number of excel sheets will be a lot. Can you suggest an easier way ?
As long as, you have the activities defined - Macro is still the better thing to look for.
There could be some things that could change.
Please explain the problem with the help of code.
If you have defined the steps with a few variables, it should be easy to write a macro that wouldn't stop in case of variation.
Please post the code and describe in detail what you would want? which point does it stop, in case of variation? What would you like the code to do?
EDIT: Alternatively, you can write code in VB6/.net (c#/vb.net)/Python for automation.
If you record these steps using the macro recorder it will work fine, these are the ideal types of things for the macro recorder as the parameters (i.e. your sort by and delete conditions) are always the same. Just make sure that you always import/paste the data to the same place!
Thanks
Ross
Related
I've found several sources that appear to give me a solution to my need, but each one has come up short. I think my solution is in using VBA UNION; however, I am a complete VBA noob, so I feel like I shooting in the dark. Here is my need.
I have a worksheet with multiple tabs.
Each tab has the same headers for the first 10 columns.
I'd like a sheet that is a summary of the first 10 columns of all other sheets combined.
I thought if I made each sheet a table and named each, I could create a range of ranges and then just call that combined range on the summary tab. My thought is there a solution somewhere with Union here, but I don't know enough to know if that's right or not.
I need basically what this solution is, but rather than it running on a run command and doing a copy/paste, the result just needs to dynamically update. https://danwagner.co/how-to-combine-data-from-multiple-sheets-into-a-single-sheet/
As a Google Sheets user, this is super simple, but I have to use Excel for this. I feel like there must be a simple solution that I am just completely missing. In Sheets I'd have just done ={range1;range2;range3;etc} and I'd have had my output, if that helps someone get what I need.
Any help here is very much appreciated.
Part of what is great about VBA is that it is an event-driven language, so you can set your code to run every time a cell is changed, workbook is saved, etc. instead of having to press a button. I recommend reading up to section 3.1 of Excel VBA Events - An Easy Guide where it explains how you can use:
Private Sub Worksheet_Change(ByVal Target as Range)
CombineDataFromAllSheets
End Sub
I try to do something simple like subtract two cells from each other, then drag the cells down to calculate all rows, and Excel just gives me one value for this action.
I made a video and posted it on youtube to show what I mean (just a minute long!):Excel Issue
Is something wrong with my excel processor? It's for a fairly large dataset (10000).
Thank you for your advice
Please be sure that you enabled the Automated Calculations in your Excel Spreadsheet, go see some of the sites here to enable it
Run calculations if Workbook is in Mode Manual
Activate automatic calculations
From your video it seems you excel calculation option may be set to manual. Make it automatic. Please follow the below screenshot to change calculation option to automatic.
Go to Formulas tab.
Under Calculation section you will find Calculation Options.
From Calculation Options select Automatic.
I am looking for a way to prevent formulas in my spreadsheet from automatically updating unless I trigger them. This is a massive spreadsheet with literally millions of formulas that all attempt to update every time any cell is updated, which lags out my system a lot. I was hoping to create what I imagine will likely be a vba macro which will disable formulas from updating entirely, and add a button which can be pressed to then force formulas to update.
If this is not possible (I am finally learning that excel has more limitations that I first thought), I could then use some advice on how to potentially smooth the formula updating process. There is no way to trim the program or reduce the number of formulas present, and using multiple sheets to communicate would just make everything look too sloppy. Any advice is appreciated, though a direct answer to the first paragraph is preferred.
You may try : Formulas > Calculation options > Manual .
Hope that helps. (:
you can go to Excel Options> Formulas > Calculation options > Manual .
When you want to update the formulas just click F9 button which will manually update all the formulas.
I hope this Helps
I have a 60mb excel file that has all of the "sins"... Array formulas, VBA and conditional formats. It crashes all the time and it's now being suggested that it's too big. There are about 20 worksheets and 3 of them are 15mb in size and each have about 35,000,000 active cells. Is this why the sheet crashes?
Yea I have this problem also.
This is a compilation of hat works for me. Some of this may be relevant, some may not.
Turn off automatic calculation. If you are desperate about this, then turn it off while doing the rest of the list but turn on afterwards
Make a backup. Everytime something on this list works, make a new backup. Excel has no brain, make sure to use your own.
Remove empty-but-not-empty cells... Sometimes, for a number of reasons, excel finds it necessary to keep track of all possible rows and columns.
I fix this by recreating whatever chart I have made by copying the specific areas that are needed on new sheets and then delete the old one and rename the new one to match. Search/replace will fix formulas afterwards if they get buggered. You can also mark the rows/cols and right-click -> delete rows/cols but that may cause a total freeze so I prefer the former method.
Get rid of the array formulas. Seriously, they can in 90-something % of the time be replaced by a cleverer sumproduct, sumifs or index(match()) formula or by adding columns or doing things in 2 steps. They are resource hogs. Leftovers from a different age. The only time I accept arrays is when I know I have exhausted all possibilities.
Very important, save the files as x64 binary formats for the files (.xlsb). Do not use the "compatibility" format (.xlsx) and for the love of god, do not use regular .xls
Move all graphics to separate sheets, and better yet, separate files. Mirror the result data via vba, copy paste, whatever to separate files and have your conditional formatting, images, graphs, progress bars, gantts, whatever there.
I hope it's not inappropriate to post this.
After some stalling and perhaps some skepticism, I replaced all of the array formulas in my sheet. There were approximately 1,500,000 cells affected by array formulas and I didn't relish the thought of redoing this. BUT WHAT AN UNBELIEVABLE DIFFERENCE! The sheet now runs faster, better and very reliably! I'll never use an array formula again. Thank you!!
I am using a simple macro found in internet for Multiple Goal Sheek in Excel 2010. The link is here
The point is that the macro is working in the example test MultipleGoalSeek(KB19).xls.
given in that link.
But when I try to apply it in my excel sheet, it only solves the first Goal Sheek problem, leaving the others un-calculated. I have no idea why although the macro seems pretty easy (maybe because they are not integers?)
I attach my excel problem with the macro.
Thank you
Hmmm .... this is a very early piece of brettdj code, it dates back to my beginner days a decade or so ago. And it shows .... !
The issue is in the third last row of the code, contrary to the instructons in the file, it was designed to work over columns only (I was running a time-based inventory adjustment at the time)
Change
For i = 1 To TargetVal.Columns.Count
to
For i = 1 To TargetVal.Cells.Count
And it works fine on your sample
I will work on the orginal code to run with variant arrays.