VBA code to do loop of transposing multiple data from single column - excel

I have thousands of data in a single column and I want to transpose these to a different sheet, I have added a number for each type of data in the column, it looks like this
so I want the code to copy and paste as transposed to another sheet then start again to the next row after 0.
Any help is greatly appreciated thanks in advance.....

I would make a "for each" loop and test for each line the type's number of the information. Then following the number copy and paste it in the right sheet. To know on which line you need to paste, you can have a long variable in each sheet to increment for each paste. Or you can use ".End(xlUp).Row" to know the last cell of the column.

Related

Code for copy data within a range to notepad

I don't understand coding, I've tried but it just doesn't make sense to me. Much respect to all who can learn and understand this complex other language. If any of you can help, I'd be grateful.
I suspect this is a simple problem to solve...
I have a range of cells, A1:E30, in cells in columns B and C within this range data is entered using drop down lists, when certain data is entered into these cells information is automatically entered into columns A and E on the same row. Not all cells within the range will contain data.
What I'd like is a command button that when pressed will copy only the cells within this range that contain text and then paste that text into notepad, without any blank lines and keeping corresponding cells next to each other.
I can do the very basic:
Range("A1:E30").Copy
Shell"notepad.exe",VbNormalFocus
Sendkeys"^V"
The code copies the entire range, but this includes empty lines.
Is there a way to do what I need?
Any help would be most appreciated.
If the lines that are empty are within the data block, you can sort prior to copying. If the blank lines are at the end, you can find the last row of data prior to copying and only copy the data.
LastRow=Cells(Rows.Count,1).End(xlup).Row
Range("A1:E" & LastRow).Copy

Excel - copying values between sheet based on values within a range

I have no coding experience, just trying to pull together a function within a spreadsheet at work to save everyone a lot of time - would be great if anyone could help me!
So I have an excel workbook, which has multiple columns of values within one sheet, which I would like to copy across to another sheet. But I only want to copy specific columns, dependent on the presence of a value in a different column for each row.
So for example:
Sheet 1
So I'm looking for a way to check for the presence of ANY value (ie just not an empty cell) in column C, and if there is a value present in column C, to then copy the values from columns A and B into a separate sheet in the workbook. I would need it do this check for each row within sheet 1 and copy them all as separate rows into sheet 2.
Is this possible?? Ideally without the use of VBA as I have a feeling adding this in to an already shared workbook may slow it down to the point of not being able to be used?!
Thank you!
Assuming Sheet1 is as follows
Then in Cell A1 of Sheet2 enter the following formula
=IFERROR(INDEX(Sheet1!C$1:C$5,SMALL(INDEX(NOT(ISBLANK(Sheet1!$C$1:$C$5))*ROW($C$1:$C$5),0),COUNTBLANK(Sheet1!$C$1:$C$5)+ROW($C1))),"")
Drag/Copy down and across (to right) as required. Change range as per your data. See image for reference.

Vlookup and paste the entire row-Applying for entire sheet alternatively

Is it possible to Vlookup a value and copy the entire row that matches
For eg: if I am searching for id=1234 in sheet A
1234 ABC DEF HIJ
The Vlookup should return the entire values.
I am trying to apply this formula in alternate rows of a sheet-The look up value is always in Column A (in the row just above).
Is this possible?
I am a novice in Excel VBA and any help is much appreciated.
Thanks
You would need a separate VLookup for each piece of data
=Vlookup($A1,Sheet1!$A:$C,Column(Sheet1!B:B),false)
If you use this code in the first cell and copy it across it will give you the correct formula for each piece of data.
I have assumed that the data you are searching for is in cell A1 of the current sheet and that the data you are searching is in Sheet1 between Columns A and C. You will need to modify these values if you are doing something different.
To get the position of an item use the Match Function instead of Vlookup.
position = WorksheetFunction.Match("1234", Worksheets("yoursheet").Columns(1), 0)
Now you can use the position to copy the entire row like
Worksheets("yoursheet").Rows(position).Copy

Excel VBA - other sheets

I'm trying to make a Excel VBA that gets 100 lines per time in a table and send them to a new excel file separately, but I don't know how. Is there a way?
There are 2000 lines in the table, so I want 20 separate files.
Excel has some special cell types, one of which returns the cell showing the maximum extent of data in the worksheet. Research xlCellTypeLastCell in the help file. The returned value does not mean there is data in that particular cell, but that there is no data in rows or columns past that row and column ref.
Eg You can select the last cell in a worksheet with the line below.
ActiveCell.SpecialCells(xlLastCell).Select
Then use the row number of that cell to set the bounds for your loop.

Getting data to input into a spreadsheet by clicking on a button

I'm struggling to get my Excel spreadsheet (2010) to do what I want, but I'm not sure its possible!
What I have is diagrams with numbers (with the numbers in circles) on sheet two, on sheet one I have VLOOKUPs waiting to input the appropriate data. What I want, is for the user to click on the circle containing whichever number, then for that number to be put in the first column of the sheet, thus causing the VLOOKUP to fill in the rest of the data. Any ideas? I'm trying to play about with macros but I've had no luck so far.
Any help would be greatly appreciated
Jazz
EDIT: I've managed to get a macro to copy and paste the data to the correct column, what I now need is for the macro to put the pasted data into the next blank cell in the column
What if you try a command like the following:
Range("A" & Rows.Count).End(xlUp).Offset(1).Select
After you have unlocked the worksheet and copied the data, have the VB code go to the active sheet, and paste your data in row that follows the last used row in the worksheet. If you can weave something like this in, you will be able to avoid indexing the rows with a number. You will also be able to deal with the case that there are empty rows sprinkled within column A in this case.

Resources