Move columns A to E to new sheet and repeat. Excel - 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.

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.

Excel chart adapting to table with formula-generated rows -- without named ranges?

I have table-like data, and I'm looking to make a chart that displays that data. Since the data is that formula-generated from other data in the workbook, I don't know in advance how many lines it will have. I want to make a chart that adapts to this data.
Up to this part of the question, I could use named ranges to solve this.
The thing with the solution with named ranges is that it does not scale well when I have many of these charts. I have a Python script that generates CSV files that I import into my workbook as a sheet, and I don't want to have to know in advance how many of them there will be, or what they will be named. I only want to be able to import the CSV files into a new or existing sheet, and copy-paste the formulas from another working sheet, as well as be able to replace the existing CSV data with new data.
With named ranges, I would have to manually create a named range for each series of each sheet, and I would have to use the sheet's name so that the named range can be visible to the whole workbook (in order to analyze the data in a global sheet) without any name conflict. This is (more or less) acceptable when I do these steps myself now, but if I want to redo this in a few months, or if I pass my workbook to someone else, we wouldn't know why it's not working with a new sheet.
So is there any way to get this done without delving into VBA stuff? I'm using a recent version of Excel.
Per the comments, try using pivot tables, making your range extend far beyond expected results and filtering out "blanks" in your pivot and generate your chart from that. The default pivot chart is ugly but you can remove buttons and format as needed. Just remember to refresh your pivot during every update period.

Copy cells data into macro to avoid updating the macro

I want to insert the content of a cell or a row of cells into a macro to avoid having to update the macro code.
This is so that people at my office can simply update a list in a spreadsheet instead of having to go change the VBA code.
Is it possible to simply ask Excel to insert text from a cell into VBA and use it to execute the macro?
Thank you!
I'm not positive I understand your question, however to read data from a cell you would use
Worksheet(SheetIndex).Cells(x,y).Value
If you want to loop through rows to get the data doing a for loop would be the easiest way around it.
For i to j
'Do Stuff
Next
If you want to loop through all rows in a sheet find the total number of rows by getting number of used cells.
Worksheet(SheetIndex).UsedRange.Rows.Count
Honestly, I would probably have a button to actually trigger the start of this to increase usability. Code should always be written with scalability in mind so why would they need to change the macro code?

Copy varying columns to single excel sheet using a macro

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...

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

Resources