Repeat Insert Row And Formula For Selected Cells
I am in the process of developing a budget template for next year and here is what I want to accomplish through Macro to avoid the tedious mannual manipulation process (hope that's achievable). BTW, I am only an entry-level Macro user who has no background in coding.
I have attached an Excel sample but let me explain:
In each of the expenses tabs (1, 2, and so on (only 1, 2 given in the sample)), I want to be able to select a range of the data cells (A19:Q34 in "Expense 1" and A10:Q28 in "Expense 2") and run this Macro so that:
1. 10 blank rows be inserted between selected data rows
2. A sum created for each month from the four rows below) with different color
3. A Year to Date Actual and To Year End Forecast created based on the VLOOKUP of the "P&L" matching the account code by month
4. Finally grouping of the first 9 rows.
the above is what I have manually created for the first account code in the "expense 1" tab. I have 7-8 expenses groups and about 200 account codes. So mannually creating the above for each expense groups is not that terrible if this will make life easier for Macro.
I would think this is a very typical Macro issue but can't really come up with anything.
The other issue I ran into the VLOOKUP for the YTD Actual and TYE Forecast. It is to look up accont code in the "P&L" tab and match the #s. But the column numbers in the VLOOKUP do not change automatically when I copy across. Thus I have to change mannually, which is really a pain in the butt. I also know I can't copy down because that will change the account code that I want it to match. Because to be able to copy the VLOOKUP formula across the same account code, I need to use the $ to fix the account code. But to copy down I think I need that to be without the $ sign. Any solution on that?
View Complete Thread with Replies
Sponsored Links:
Related Forum Messages:
Insert Range-named Row At User-selected Row
On the first row of a spreadsheet template is a <hidden> contiguous series of conditionally formatted cells (range name "stdRow" =production!$1:$1), with formulas, that I want a user to be able to easily insert at whatever row they might be in a worksheet. If, for example, the user is at D24, then clicks the [InsertRow] button that I have positioned at the top of the worksheet (in a fixed pane), I want the attached macro to insert an instance of "stdRow" directly underneath the user position (at row 25, in this case). The use's position should still be at D24 when the macro finishes. If the user clicks the button multiple times, multiple rows should be inserted (again, without changing the user's position). This is what I have tried so far:
View Replies!
View Related
F4 Does Not Repeat Insert Rows Or Columns
My F4 key (which I use constantly) works for every "repeat" function except for inserting rows or columns. I can repeat every other option EXCEPT inserting rows/columns. I just had Office 2007 uninstalled and had Office 2003 put back on my PC. My IT group can't figure it out.
View Replies!
View Related
Insert Row At Active Cell With Formula From Fixed Row
I want to insert a new row that contains the formulas of a fixed row (1:1). The inserted row is changeable and is determined by whichever is the current active cell. Eg: Active cell is something random like E16 I want to add a new row but don't want a blank row - rather want a row that contains the properties of 1:1
View Replies!
View Related
Insert Rows & Repeat Values Based On Corresponding Cell Value
I have a list of 130 names in column A. I have a number value between 0-10 in column B (next to the name). I need to insert the number of rows defined by the value in column B, below each row that I already have (if the value is 0, then the row needs to be deleted). The inserted rows have to be filled with the name value from the row above. For example - before macro: Joe Bloggs 2 Adam Wilson 10 Peter Andrews 0 Claire Burrows 6 After macro: Joe Bloggs Joe Bloggs Adam Wilson Adam Wilson Adam Wilson Adam Wilson....................................
View Replies!
View Related
Copy Cells In Selected Row To New Sheet
I would like some code to allow the user to select any row in Sheet1 and then the populated cells (10 in every case) in that row will copy across to various locations in Sheet2. eg, The user selects Row header for Row 12 which has 10 cells ( A12 to J12) populated. A12 will go to C3 on Sheet 2, B12 to D5, C12 to D9, etc, etc.
View Replies!
View Related
Insert Row Below Cells Containing X
I'm trying to write a vba code which checks the contents of a cells and if anywhere in the cell the word " total" (not casesensitive) is present in the cell, it automatically inserts a row afterwards. Currently this is what I have but its is causing me lots of problem and coding. lLastRow = Range("C65536").End(xlUp).Offset(1, 0) For lrow = lLastRow To 2 Step -1 'Work from last row up to row 2 If Cells(lrow, 2) = "" Then Rows(lrow).Insert Shift:=xlDown End If Next lrow
View Replies!
View Related
Insert A Row And Add A Formula
I have a spread sheet that I need to insert rows into and then in those same rows, add formulas that display percentages compared to the grand total row. To make it a little more complicated, this spread sheet changes from day to day, so the rows and columns will be different each time. So the code will have to recognize text, then insert the row, then do the formulas in the blank row. The only constant will be that it will always start on Row 5. I have no idea how to start or begin to do this, so I attached a file with a page showing where I am at as an example, and then anther page showing what I want ....
View Replies!
View Related
Command Button: Copy Row Selected On Sheet2 Into Cells On Sheet 1
figuring out a code for a command button. I have 2 sheets open with the following set up: Sheet1 A2 = Name (chosen off sheet2) A3 = Job Title (chosen off sheet2) A4 = Department (chosen off sheet2) Sheet2 Column A = List of names Column B = Corresponding Job Title Column C = Corresponding Department I need to be able to choose a name off sheet2, click the command button and it send selected name, job title, and department to sheet1 to the respective cells.
View Replies!
View Related
Copy Selected Rows & Insert As Many Times As Rows Selected
The following code inserts a row below the selected row, and copies the formula of the row above into it. Dim Rw As Integer Rw = ActiveCell.Row Selection.Insert Shift:=xlDown Rows("" & Rw - 1 & ":" & Rw - 1 & "").Copy Rows("" & Rw & ":" & Rw & "").Paste However, I need to alter this to work for inserting more than one row at a time. ie. the user selects 'x' number of rows and 'x' rows are inserted below (in the same way 'Insert Row' works in Excel) and the row above the selection is copied down.
View Replies!
View Related
Apply Formula To Selected Cells Via Macro
i m trying to set up a macro to convert a range of user-highlighted(selected) cells to 3 significant figures: for example, convert 0.135564 to 0.136 the equation i found elsewhere online: ROUND(xx,3-(1+INT(LOG10(ABS(xx))))). but i can't quite figue out how to apply the equation to a selected range of cells via a macro.
View Replies!
View Related
Formula References Not Updating On Row Insert/Delete
I have a worksheet with many different formulas in many different cells. When I insert or delete a row, there is one formula in one cell that does update to reflect the change in rows. The cell is located several rows below the section where rows are changing. It is a simple formula too. Here is the formula: "= SUM($E$3:E11)*0.09". If I delete more rows that cause the highest row number to be less than 11, this formula updates. If I insert more rows and go beyond row 11, the formula does not update. I have tried using $E$11, $E11, and E$11 to no avail.
View Replies!
View Related
SumIf Formula: Add New Data With An Insert At Row 13
The formula that works is =SUM(IF('Pipeline Input'!$X$13:$X$39=1,IF('Pipeline Input'!$H$13:$H$39="Lead",'Pipeline Input'!$K$13:$K$39,0),0)) I am trying to modify this formula so that the ranges are dynamic to allow me to add new data with an insert at row 13. What would the syntax of the formula look like if I use the INDEX function to allow the ranges to grow with new data? I have tried naming the defined ranges and entering the formula as =SUM(IF((CloseMo)="1",IF((SaleP)="Lead",(LoanAmt),0),0)) but I get a #VALUE! error
View Replies!
View Related
Insert Cell To Columns Having X Blank Cells In Row
I need to put an extra "spacer" cell in each row that contains either 8 or 9 blank spacer cells in columns A through H or A through I, respectively, so that everything in those rows shifts to the right by one column. The problem is that all the other rows don't need any extra spacer cells. There is no pattern to the rows that need the extra spacer cell (such as every 5th row, or something).
View Replies!
View Related
Look Up Dont Repeat Row Of Data
I have rows of data that repeats every now and again and codes next to them What I need to do is have same row of data (without it repeating) and relevant codes next to these across the page. Tried doing Pivot table and failed. Example and proposed format enclosed.
View Replies!
View Related
Insert Formula In Empty Cells
I have a sheet that I put a blank row before every change in column G, Dim lr As Long, i As Long lr = Range("G" & Rows.Count).End(xlUp).Row For i = lr To 2 Step -1 If Range("G" & i).Value Range("G" & i - 1).Value Then Rows(i).EntireRow.Insert Shift:=xlShiftDown End If Next i and now I need formulas in columns B and I in those blank rows. I'm happy to roll it in to the above piece of code, or put it in after. I don't think I can use LastRow to define my range and replace blanks with formula because of the blank rows. I would need more of a "LastRow with only one blank in between populated rows" if such a thing exists. The formulas will be ="*"&H3&" DWG "&G3 for cell B2 and =I3 for cell I2.
View Replies!
View Related
Repeat Row Based On Text Criteria
to run a macro or any other methods to repeat the same head rows in my database as followings: Let's say the main head row is in row 1. Item names such as Item A; Item B; Item C ....in column A What I want is to insert the same head row after the list of each item. Item name (head row) Book A Book A Book A Item name (head row to be repeated) Book B Book B Item name (head row to be repeated) Book C Book C
View Replies!
View Related
Insert Rows And Copy Formula Cells
I am trying to finish off a form that allows a user to insert a row below the selected cell and copy the formula from the line above if one exists. The code inserts the line but does not copy the formulas if they exist. Application. ScreenUpdating = False Dim cRow Dim j As Long cRow = ActiveCell.Row With ActiveCell .EntireRow.Insert End With For j = 1 To Cells(1, 255).End(xlToLeft).Column If Cells(cRow, j).HasFormula Then Cells(cRow, j).Copy Cells(cRow + 1, j) Next j
View Replies!
View Related
Changing Row Collor Based On One Cell - Repeat
I have 4 condition which change row 3 to different color: example of one - cells on row 3 will change to Blue "=$A$3:$AE$3" on condition =If($AE$3="Absent"; True;False). How can I repeat this formula for rows 4 to 500. i.e. on each row cells A to AE should change color based on the value of Cell AE? (Colum A was hidden, MUST be visible to work)
View Replies!
View Related
Repeat Row Labels On All Lines Of A Pivot Table
I have a pivot table in Excel 2003 which summarises one field (subjective) then totals at the change of a second field (cost centre). I want to show the cost centre label on each line of subjective. In a standard pivot table it only shows the cost centre with the first subjective in each group.
View Replies!
View Related
Not Repeat The Same Formula In Each Cell, Over And Over Again
I have a 34-page workbook. On Every Row (starting on line 4), and on Every Page (except the first "Summary" page) is repeated, this same formula....over and over again in column "N": =IF(A4<>"A",(IF(AND(A4<>"A",OR(J4="",J4="NT")),"OK","WARNING: EXECUTION NOT EXPECTED OF LOW PRIORITY TEST CASE!")),IF((LEN(J4)=B4),"OK","WARNING: STATUS DOES NOT EQUAL TC COUNT!")) So, since this keeps repeating over and over again, is there some way (either by formula, macro, or whatever), that I can prevent the constant repeating on every line, to bring the file size back down? [Note: This formula alone actually added almost 5MB to the file size!] Two things to know: - The formula above is seen on row 4 (that's why you see "4" all over the place). On Row 5, it would be "5" instead, and so on... - The formula above always starts on row 4, and goes down to the "last used" row, in column "N" (so there's other information in that last used row as well). ....hopefully this is a very easy thing to do? (PS: Thanks PeterSS for the help creating the above formula in the past...hopefully it can now be made less repetitive to conserve ~5MB of file space!)
View Replies!
View Related
Repeat VBA Formula
How do I keep repeating If Range("E22").Value Range("G3").Value Then Rows("22:22").Select Selection.Delete Shift:=xlUp Until E22 does = G3 Then I need it to go to Row 23 and do the same. My goal is to leave only rows (between rows 22 and 50) that have the same value in its column E that match cell G3.
View Replies!
View Related
Repeat A Formula Automatically Every Seven Columns
I have a formula that is working, but I want to repeat it every seven columns. I know I can drag it and release it (or drag a few and release them in the appropriate column), but at this point I have so many columns that it's quite cumbersome to do that. Is it possible to create a macro that will automatically repeat the formula in every cell seven columns to the right (the same row for all)? My formula is in cell K7 is: =IF(AND(K24<=0%,K24>=-2%,OR(J32="T",J32="F")),1,"FALSE") Now I want that formula to repeat (with the proper adjustments) for cell R7, i.e.: =IF(AND(R24<=0%,R24>=-2%,OR(Q32="T",Q32="F")),1,"FALSE") and then to automatically continue like that for cells Y7, AF7, AM7, and so on.
View Replies!
View Related
Repeat Vlookup And Find Or Search Formula
I have a column of text strings in a2.a??? this is my data. Each text string has a persons name somewhere in it with other text around it. In column c2.c??? i have text names of people names im searching for. eg. bob,jane,harry what would be a pratical use of the vlookup function to return the name in column b2.b??? if the name from C was located in the string in A this is a non case sensertive requirement.
View Replies!
View Related
Pulling Multiple Matches (formula Repeat?)
I'm looking for is to repeat this formula within the cell, so that it can pull the information of not only the first match, but all matches proceeding it. Right now it only pulls the first match it finds, but I would like it to add every time a row matches the criteria of the formula. =(LOOKUP(2,1/(('Paste SFHS'!$A$2:$A$9=A2)*('Paste SFHS'!$B$2:$B$9="08-Wave/Stu. Goals")),'Paste SFHS'!$C$2:$C$9))
View Replies!
View Related
Repeat Data As User Fills In Other Cells
I've been trying to find something that can do the following. I would like Column D and E to auto fill with a repeated data when the user fills out column B. For example, Column B | Column D (auto filled) | Column E (auto filled) 101 | 1 | 1 102 | 1 | 1 103 | 1 | 1
View Replies!
View Related
Adding Rows With Control Number That Only Repeat 3 Times: Formula
I'll try to explain this the best I can. What I have here is a time study. Teachers (which are the control numbers) fill out bubble sheets, then I run them through a scanner. After dissecting the data from the scanner and formatting it to my liking i get this below. Each teacher/staff member fills out three sheets per quarter. Each letter (bubble) counts as a 0:15 min period of time. Only K thru Q counts as billable time, which I've created a formula to count those letters (column 3). But to be countable each control number has to have three cycles 201,202,203. So I need something that can take each control number that has three cycles and add their # of 0:15 together. The italic row below only has one cycle for that control number, so that needs to be deleted or ignored. Ultimately I would like the results on a separate sheet. This is only a part of the file, there are over 1000 different control numbers.
View Replies!
View Related
Identify Button (shape) Row To Insert Row And Delete Row
I have a button (group containing and add and delete button). I want to identify the row (position of shape/button calling the macro) to enable inserting a new row (1 row down from current row). Then do the same to delete a row (position of shape/button calling the macro) to enable deletion of selected row. This will allow me to add/insert rows by the button located at that row The problem i have is getting the row property (row position of the button eg. TopLeftCell.Row) of the add button. The add button (RowBtnAdd) is a shape within a group (BtnGrp) I also note that when a group is copied, it has the same shape name as that copied. I want to keep the add and delete shape within the group (BtnGrp). I do not want to select a cell or row or enter a row number to delete etc. refer to sample workbook attached. Currently only has one record row.
View Replies!
View Related
Stop Formula Column Reference Changing On Insert But Not Row Reference
A 'Days Attended' cell (N8) and a 'Days Absent' cell (O8). N8 needs to count the number of "Present" values there are on another worksheet. The other worksheet has dates across the top and names down the side. When i use =COUNTIF("Attendance!C9:Z9", "Present"), and the next date comes along the formula changes to =COUNTIF("Attendance!D9:AA9", "Present") ie. the reference moves a column across - the new date's absent or present is not counted. Using =COUNTIF(INDIRECT("Attendance!C9:Z9"), "Present"). is no good because when i add a new name i need the row reference to move down as a row is inserted. ie. both person's formulas count the same row. So, my question: I need the columns to stay the same - C:Z (leyway for future dates) and the rows to change as i insert or delete people from the system.
View Replies!
View Related
Insert Row On Sheet & Move Active Cell Row To It
I would like to create a macro that could archive entries from one sheet and insert them in another. I created one but the problem is that the entry has to be the same row each time. Example: Sheet 1 – is current jobs and sheet 2 is old jobs. My macro moves an entry from Row A-5 of Sheet 1 and moves it to the top of Sheet 2. I would like to be able to scroll through each entry select it and have it moved to the top of the Old Jobs sheet.
View Replies!
View Related
Insert Row Syntax - Resize Row VBA Error
I need to insert rows in row A44 depending how many cells exits in a range i named "ALL_C" I saw this code that inserts 10 rows on A44 so i thought by modifying it the way i did would work but it didn't. I'm still new at this stuff. What am i doing wrong? Original Sub Insertinrow43() Range("A44").Resize(10, 1).EntireRow.Insert End Sub Modified (doesn't work) Sub Insertinrow43() Range("A44").Resize(Count(All_C), 1).EntireRow.Insert End Sub Thank you!
View Replies!
View Related
Auto Insert A Row With Info Populated From The Row Above
to be able to do is have a stock control sheet that tells me how much of 1 item we have in stock which is easy, the hard part comes when this stock is sold as this stock can be sold to a number of different customers e.g. We have 10,000 X Pens Customer 1 buys 1,000 Customer 2 buys 6,000 Customer 3 buys 3,000 i need a way of saying that we have 10,000 pens but if we sold 1,000 then we can click a button (macro maybe) and that will automatically see that we have 10,000 for that line and we have only sold 1,000 so we need a line inserting saying that we have 9,000 remaing and so on.... The sheet needs to record who these goes to though, that the reason i was thinking of adding a row If this doesnt make sense then i am happy to answer your questions? i can upload an example excel sheet if required if someone can explain how i do this?
View Replies!
View Related
Insert Row And Copy Cell From New Row
Attached is the sample workbook. I have a workbook with 2 sheets. Sheet1 contains all question and answer question. When the user select "Comment" as an answer, it will trigger to insert a new row on sheet 2. My question: is there any way I can copy from the comment fill in column c on new row to Sheet1 " Comment column"?
View Replies!
View Related
|