Copy varying columns to single excel sheet using a macro - excel

I am trying to write and excel macro that will copy data from an excel file with multiple sheets. Each column will have different lengths and the name of the sheet will not always be known. I want it to start by having the user select the original file and a new one be started, which is where it will be copying to. There are multiple columns and only two of them I am interested in. They are the m/z and the intensity. I also have to know which sheet the value came from. I would prefer it if they sheet name was presented in a column next to the combined m/z's and intensity's. I am new to this and can use all the help available.

As above - use the macro recorder and make sure you are using named ranges.... an example upload would also help p[eople help you...

Related

Powershell Xlookup Multiple sheets

Hello all im not sure what im going to ask is possible but I guess ill find out.
I have 1 sheet from a ticket that has Printer numbers that I need to import to 30 sheets that hold the printers and their location. Right now I'm just opening every sheet and doing a xlookup into the column I need and then copying the xlookup to each sheet. Then pasting valuables because I don't need the formula when I'm done as the data will not change.
I would like to know if there is a way i can implement PowerShell or maybe VBA so that I don't need to open each sheet and do lookup copy column then paste text as its very time consuming. It would be a bonus if I get this to work without pulling the sheets out of sharepoint also.

Move columns A to E to new sheet and repeat. Excel

I have slightly different data but same format in one excel sheet.
Each data set is 5 columns. The first data set is column A-E, the second data set is column F-J, all the way through to DID-DIH
What I would like to do is to extract these to either their individual sheets or individual workbooks
Is this possible? Perhaps using VBA code?
Sorry I am an amateur trying analyse a massive data set
A good way to get started would be to hit the record macro button and copy the first columns manually. Then stop the recording and look in the VBA editor at the code produced. Wrap this in a loop and make the necessary changes to move columns etc. Have a go and post the code if you get stuck.

Pull names from column in sheet 1 and place in column on another sheet removing duplicates

I'm looking for help with a formula if possible.
I have a sheet within a workbook called 'RAW' and in column 'I' it has a series of agent names. What i want to do is copy these names into the sheet named 'YTD' into column B but in the process of this also remove any duplicates that appear in the new unique list.
The formula i was working with is below however i when i try to amend it to what i need i get circular reference errors. Any help appreciated.
=INDEX(Raw!$I3:$I10000,MATCH(0,INDEX(COUNTIF(Raw!I:I,Raw!i:Raw!i),0,0),0))
For tasks like this, I recommend you use the available manual tools already present in excel. Simply copy and paste the column as you would, and then in your new list, go to the Data Ribbon > Remove Duplicates.
Automation should be used when you have consistently repeating tasks with exactly the same form of input and output. For all of the random things you need to do in excel, relying on automation developed elsewhere can greatly reduce your actual speed at performing these tasks.

Copy a column of formulas to a closed workbook in Excel

I have a lot of data into Excel files.
There are about 174 files. Each is named Book2.xslx through Book174.xlsx
I have a master document where I have a column of formulas that I would like to paste (or insert) into each of these spreadsheets without having to actually open each one individually.
Does someone know any code I can use to do this?
As an example, I would say I would want to copy the range P:P - the whole of column P - and insert it or paste it into Column P in the closed workbooks.
Can this be done? If it works , and I want to insert different ranges and cells every time I wanted something different inserted or pasted? Or is there a macro for example, that I could run , that would copy what I've selected to the same place in every unopened spreadsheet named Book*.xlsx?
You cannot do this on existing files without opening them (whether in Excel, or using FSO, as the Object Model won't be available to apply to those files
having said that, it is possible to automate the modifications using VBA.
If you would post your code, we can help you improve it or resolve any issues with bugs or performance

How to build a chart in excel, such that the source file containing data can be changed interactively?

I have a directory with many excel files with numeric data. In each file the data is arranged in the same manner (the same column names, etc...). I am interested to build an interactive
chart which will display the data according to the chosen file name.
For example, the file name will be chosen from validation list in a drop down menu fashion.
The question is how to specify the data range in the chart, such that it will change according to the name of the file that I choose.
I work with excel 2010 and don't have much experience with VBA programming :(
Thanks a lot,
Sasha
Well, a simple solution (there may be more elegant ways but that's a first hint):
Copy the data from your files in the Sheets of your workbook, you can create references (see here) or automate copies through macros (just STFW)
Create your validation list (for instance on Sheet1, cell A1). Let's assume this list contains: DataSource1, DataSource2, DataSource3.
Create Named Range for every other Sheet you have and use the same name as the one in your list (DataSource1, DataSource2, DataSource3)
In the chart source of values, use this formula: =INDIRECT(Sheet1!$A$1)
Hence, Excel will translate the source to the Named Range.
You could probably find solutions with vba too depending on your needs.
Regards,

Resources