Macro To Separate Lots Of Rows With Certain Amount Of Blank Rows
Feb 15, 2014
I have been using this macro to separate lots of rows with a certain amount of blank rows.
Dim j As Long, r As Range
j = InputBox("type the number of rows to be insered")
Set r = Range("A2")
I trying to change it so that, instead of inserting how ever many blank rows, it just copys the row above.
Example (Row A to C)
I have been messing around with macro recorder and i could select each row and paste it into the blank rows, but from researching on the internet selecting and pasting data seems to be a waste of resources (ram?) and i will be running this on a couple hundred rows (lots of data). Also, i would like to keep the functionality so that i can still choose how many times it copys/inserts each individual row from a input box.
I eventually want the data to end up like it is shown in the table but i am takin it one step at time because i want to understand what the code is doing.
I would like to have my macro code search column A (supplier numbers) and split the rows into groups of rows of 5 or less and then insert 3 blank rows between each group of rows. The split needs to start on a new supplier number and cannot split a supplier number into two different groups. Here is a sample:
Company 1 Contact 1 Address 1 City, ST, ZIP 1 Phone 1 Fax 1
Company 2 Contact 2 Address 2 City, ST, ZIP 2 Phone 2 Fax 2
Company 3 Contact 3 Address 3 City, ST, ZIP 3 Phone 3 Fax 3
I want this:
Company 1 Address 1 City, ST, ZIP 1 Phone 1 Fax 1 Company 2 Address 2 City, ST, ZIP 2 Phone 2 Fax 2 Company 3 Address 3 City, ST, ZIP 3 Phone 3 Fax 3
all the way down.
I can't figure out how to record the macro to tell it to then skip the blank line, collect the next set of data, and put it in the next row. I can do it for two, but then it just replaces the first two with the next two and I lose data.
I am trying to count the # of rows in a spreadsheet in which there is non-blank text data in 2 separate columns. For instance, if the spreadsheet looked like the one below (dashes just for formatting purposes):
NAMES-------THIS-------------THAT Mary-------some text--------some more text John-------<blanks>---------just text here Sue--------just some here-----<blanks> Dave-------something--------something else Adam------<blanks>-----------<blanks>
The total # of rows with something in both the "THIS" and "THAT" columns above would therefore be 2.
I'm trying to convert a very large list of phrases into one list of phrases in one column in excel.
The original list is separated by commas. I can get part of the list to show when I import they're coming up in hundreds of columns instead of one column with hundreds of rows. I want them to be listed horizontally, each phrase in a separate row but in one column. How do I do this? I would transpose from the columns into rows but it's cutting off the data when I import.
I am needing to sort individual rows horizonally (by columns) - sound simply enough, but apparently its not (unless I'm overlooking something really basic). For example, I need to sort each row (2 - 300) beginning in column B and ending in column P individually. I can do this - one at a time - using Excel's sort function, but its time consuming and this is something I need to be able to do on a regular basis.
I want to create a macro that will copy and paste a couple seperate collumns but the problem is that each month, and each invoice, contain a different amount of rows so I can't "record" a macro. Lets say I start on A4 which is the heading of Column D..below it are a bunch of records at the end of the records is a space. I need it to stop there. Then do the same for Column G, I, etc. I would like it to copy each column and paste in a new workbook.
I am working with an excel spreadsheet. There is a column for "name", and then the next column is for medical condition.
If the same patient has multiple (say, 4) conditions, the rows for "name" are combined into a single cell(let's say, a cell going from row 2 to row 5, witha a single name in the combined cell) , with the next column having four different cells adjacent to the single cell (cell 2 has "bleeding", cell 3 has "fever", cell 4 has "diarrhea", and cell 5 has "rash"). Some patients have only single conditions, single cells.
Will this mess up COUNTS and COUNTIF?
Is there a way to split the combined cell2-5 for ''name" into four cells all containing the same name?
See the attached xls. There are two worksheets contained therein, one with the original data, and the other showing how I'd like it organized.
I have rows of product data consisting of a product id followed by repeating attributes of quantity and associated price. I need to convert each product row to multiple rows of each quantity/price pair while preserving the id for each pair.
A B C D E F G H I J K L M N O 1 ** ** *** ** ** ** ** *** ** *** ** ** *** ** ** 2 ** ** *** ** ** ** ** *** ** *** ** ** *** ** ** 3 ** ** *** ** ** ** ** *** ** *** ** ** *** ** ** 4 ** ** *** ** ** ** ** *** ** *** ** ** *** ** ** 5 ** ** *** ** ** ** ** *** ** *** ** ** *** ** **
I need a macro that can automatically export the cell data for each row from Column A--> O into it's own seperate text file, and name each text file with the text in column A. So again... everything in row 1 from A to O would be copied and pasted into a text file called (A1 cell data).txt
once that first text file has created, I was hoping that there could be a loop to automatically close the first text file and move on to row 2 and do the same, copy all text in row 2 from A to O into a new text file titled (A2 cell data).txt, close and move on to row 3 etc etc.
this is a large list of approximately 8,000 records.
I am able create a macro using the find function to find the next blank row, but I would like to have it select a range of rows down that I can then delete. Each time I run the macro the next blank row may be different thant the last, so it can't be a set number of row numbers each time. I could also possibly use the print area function if it would be easier.
Here is what I have so far, what is in red is where I need it to vary from next active blank row down to R2001C14, and then delete all the active blank rows ...
I am working in the attached spreadsheet. For anyone who does not wish to open the link, let's say these sheets are titled 'Sheet1' and 'Sheet2'.
Sheet2 looks like this:
Year Cat Name 2013 4 Sal 2013 4 Pat 2013 3 Pat
Now, how may I pull this data into a summary sheet (Sheet1) that skips over any instances where column A ("Year") is blank so it looks like this:
Year Cat Name 2013 4 Sal 2013 4 Pat 2013 3 Pat 2013 2 Pat 2013 5 Bob
Note: All columns are the EXACT same across each sheet(including Sheet1, Sheet2, Sheet3), if that extra piece of information works.
PS It is fine if, in order for a formula to work, I need to copy and paste the formula for the length of rows per each Sheet to consolidate.
So, in my industry, any summary-level data (shown on Sheet1) must have a linked reference to a particular sheet (Sheet2, Sheet3, etc.) so the user knows where the raw data came from. This is to ensure increased accuracy of data and minimize human error (like, if for example, I accidentally didn't copy and paste all the rows correctly).
I have uploaded the actual sheet to show what the data actually look like. I am trying to pull in 2013 data into my "Summary Page" and would like to have all the data linked to the '2013' sheet but skip any blank rows.
i have this code which inserts blank rows in alternate rows,
Code: Sub insertrow() ' insertrow Macro Application.ScreenUpdating = True Dim count As Integer Dim X As Integer For count = 1 To 20 If activecell.Value "" Then activecell.Offset(1, 0).Select
what changes should i make in this code to insert rows only when ther are now blank rows. So first time i run, blank rows are already there, and when i update some data at the bottom and re-run it inserts blank rows again.
I am looking for some VBA programming that will allow me to use 1 button to consolidate rows (delete them). The problem I am running into is that the rows I want to delete have formulas in them so I can use "find all blank cells & delete" type of macro.
Attached are a couple of brief images on a small scale what I am looking to do.
I want a user to be able to have this sporadic list of choices, consolidate them so the are all one right after each other, then export to a word file for editing later on.
I've added a button with a macro to delete any blank rows in a worksheet.
Cell A3 is completely blank and A6 has an IF formula which returns "". In my macro it copies the whole worksheet and then paste special values, to take away the formula in A6 and then deletes the blank rows but it still does not delete row 6.
I'm trying to find a way to delete blank rows that contains formula. I have two excel sheets. sheet1 contains information and sheet2 references the values from sheet1. Let's say I put the following values in sheet1:
ColA AAA (blank) (blank) BBB (blank) CCC
After entering above values in sheet1, here's what sheet2 would look like:
ColA AAA (blank that holds formula) =IF(ISBLANK(Sheet1!A2)," ",Sheet1!A2) (blank that holds formula) =IF(ISBLANK(Sheet1!A3)," ",Sheet1!A3) BBB (blank that holds formula) =IF(ISBLANK(Sheet1!A5)," ",Sheet1!A5) CCC
What I really wanted to happen is for macro to eliminate blank rows in sheet2 to look something like: ColA AAA BBB CCC
What I have are dates in Column B with a lot of blank rows in between. For example: cell B2 has a date in it and then the next date would be on cell B54. I need a macro to copy cell B2 until it finds a new date (which is in cell B54) then copy the date in cell B54 until the next date again.. so on..
I have a spreadsheet with a list of names from cell A5 to A? - can be as many as 130 names or as few as 20. I have to create individual spreadsheets with the persons name as part of the filename. I have 3 subroutines which work manually ( CreateFile, LookUp and NewWorkbookSave ) so that I can generate individual files for those users who require them. However I need to be able on occasions to create a full teams worth of files with one click - to this end I need to be able to loop through cells A5 - A whatever and call the Subroutine CreateFile - I enclose the code I have so far
Const Fname = "AON Ver 3,0.xls" 'insert filename here like "AON Ver 3,0.xls" Const DirName = "\Ukplscs105central repositoryAOMTally SheetsTeam upload Tally sheets" Const TeamName = "AON" ' insert team Name here like "AON" Const FilePath = DirName & TeamName Dim count As Integer
I have a worksheet used for inventory. In Column A is the quantity (to be entered manually). In Column B is the product description. In Column C is the price of the product, and Column D the total price (column C price x the quantity entered in Column A). At the bottom of the worksheet is a grand total. Also, Column B (products) is grouped into subheadings by the supplier each product came from (for example, row 6 has the title PPG, and then rows 7-137 list every product from PPG).
The calculations in this worksheet work fine. What I am trying to do is, using a macro once all of the appropriate quantities are entered in column A, automatically hide every row of product that does not have a quantity. The tricky part is, if no products under a given supplier subheader are entered, the subheader also hides, and if a quantity is entered, that subheader shows. For example, if I have no quantities under any products for PPG, then the PPG subheader hides, but if just one quantity is added, PPG shows. Also, this list will be constantly updated, new products will be put in and taken out all of the time, so I cannot base the macro on a specific number of rows.
I have an imported report in a spreadsheet. It imports to three columns. I need to check each row in column A for three seperate criteria and delete the rows I don't need. I need to delete blank rows and check next row for page header info. Delete these and next rows to next blank cell. Check next row for page header and not delete if not page header. Several rows down will be a cell with 23 blank spaces before the word Reg: and sometimes other words past this but always this first. This row is to be kept. I looked at the FAQ's example of Deleting but I don't think it will work. I also need to put a key word in column A at a point where I want to stop. This report is a couple thousand rows long so a VBA procedure would really save time. I have a procedure I use to check for two zero's in two cells that hide these rows but I couldn't modify it to work on this report.