Adding And Deleting Rows In Worksheet While Maintaining Formulas?

Mar 26, 2014

I have a Productivity Report that contains very basic formulas that provide totals for 4 columns (B6:E6) and an average for one column (F). I have included two command buttons, one to add a new row and the other to delete a row.

I need to be able to add or delete rows depending on how many employees' productivity I will be tracking on any given week; each row represents a separate employee. I need the following functionality out of my form:

1) formula in column F needs to copy and paste with each new line
2) when a new line is copied and pasted I need the contents to be cleared
3) I need the user to be blocked from deleting the first row (3 on this form) in the table

The code I'm using for my "Add" button is:

[Code].....

The code I'm using for my "Delete" button is:

[Code] .....
The buttons add and delete rows as I'd like them to but content is not clearing, with each row added the contents provide a sub total. I've tried various lines of code (some more complicated and some less) before I recorded my own macro (see above).

Attached File : Productivity Report (HH).xlsm‎

View 8 Replies


ADVERTISEMENT

Deleting Worksheet Causes #REF! In Formulas

Sep 4, 2006

I have a macro that imports a text file. I then have summary sheets that reference to the sheets with the imported text file details. This is a task I complete every month.

The next month I delete the sheets with the imported text file details before importing current month's details. But when I do that it screws up my references.

Here's an example of a reference with previous months' imported text file details:

= SUM('X'!$I$1:$I$3000)/2+SUM('Y'!$I$1:$I$3000)/2

When I delete the sheets with the imported text file details and import current month's details, my reference suddenly looks like this:

=SUM(#REF!$I$1:$I$3000)/2+SUM(#REF!$I$1:$I$3000)/2

What can I do to prevent the summary sheet from messing up my original references?

View 3 Replies View Related

Adding & Deleting Button On Worksheet

Oct 24, 2006

I am trying to create two macros. The first macro will add a button, and the second macro will delete the button. I am noticing that when I add the button in the first macro, Excel is automatically naming the button (i.e. Button 26), and then when I try to delete the button with the second macro, this button name is not recognized. How can I name or set the button as a variable so that I can successfully run these two macros?

View 6 Replies View Related

Deleting Rows Without Modifying Formulas

Apr 9, 2009

I have a large amount of data on a sheet which is being looked at by the following formula

{=AVERAGE(IF(LEFT(RAW_DATA!$C$4:$C$10000,LEN(Dashboard!$I$10))=Dashboard!$I$10,IF(RAW_DATA!$A$4:$A$10000=$A2,RAW_DATA!$J $4:$J$10000)))}

However, i don't need to keep the oldest data so I want to write a macro that deletes some of the top rows. Doing this in the normal way causes the formula above to change. I.e deleting one row cause the range to become $J$4:$J$9999 and so on.

Is there any way of deleting a row without affecting the formulas that are looking at it?

View 9 Replies View Related

Adding And Deleting Multiple Rows

Jul 9, 2013

I have a spreadsheet with multiple similar entries I would like to add up. What would work well for me is to be able to input a column like a and a target column like e.

So in this case it would search throughout column a and wherever it finds a duplicate entry add column e and then delete one of the rows. I could then run it again under different column criteria if needed.

So if I had the below sheet:

I could search by column a and add up column h to read like this:

View 1 Replies View Related

Conditional Formating - Adding & Deleting Rows

Nov 9, 2008

I am using several formulas to conditionally format and fill in rows from column A to column BS. These are the formulas and application areas:

=$BS4<>"" Applied to =$A$3:BS$350
=$G3<>"" Applied to =$A$3:BS$350
=OR($J3="Regional Manager",$J3="Assistant Manager",$J3="Manager") Applied to =$A$3:BS$350
=OR($J3="Recruiting Manager",$J3="Owner",$J3="District Manager",$J3="Office Manager") Applied to =$A$3:BS$350

If I do not add or delete any rows, everything works just fine. The problem I am running into is that this list is constantly updated and rows are being added and deleted. When I do this, it duplicates my rules and changes my applied to ranges. Here are some examples of the changes:

=$N$3:$BS$3
=$A$3:$M$63
=$N$4:$BS$64

This creates much excess work, when I have to go back and change everything back to the way it should be. how I can either modify my formulas or application areas to correct this situation?

View 4 Replies View Related

Automatically Adjusting Sum Of Numbers When Adding / Deleting Rows

Jul 21, 2014

I currently have this formula to deal with this:

=SUM(J5:INDEX(J:J,ROW()-1))

However, whenever I delete the top row...I get a reference error and have to re-adjust...

View 7 Replies View Related

Automatically Adjusting Sum Of Numbers When Adding / Deleting Rows?

Jul 21, 2014

I currently have this formula to deal with this:

=SUM(J5:INDEX(J:J,ROW()-1))

However, whenever I delete the top row...I get a reference error and have to re-adjust...

View 9 Replies View Related

Deleting And Adding Rows Based On Date Criteria

May 21, 2006

ColumnA in my data base contains dates. How can I delete the entire row if the date is before today's date and add a new date at the end of the range to replace the deleted row.

View 9 Replies View Related

Lock Cell From Moving When Adding/Deleting Rows Or Columns

Jun 16, 2008

Will excel allow text to be permanently be positioned in a specific cell even if rows or columns are added?

View 6 Replies View Related

Inserting / Deleting Rows And Cutting Cells Causing Corrupted Formulas

Dec 12, 2013

Whenever you insert / delete row or cut cells out in Mon/Tue sheets it's causing issues in the table in the Weekly view tab.

Is there any way to prevent it? I don't mind redoing whole spreadsheet, it was done ages ago in a very fast manner.

I gave you an idea by deleting a row range in Mon tab which causes #REF error.

View 9 Replies View Related

Excel 2007 :: Adding And Deleting Rows With Hide Row Macro CheckBox?

Mar 18, 2014

I currently have the following Macro for one of my many checkboxes in 2007 Excel:

[Code] .....

It works perfectly until additional rows are added/deleted before the indicated rows in the code (It changes the number sequence in the workbook). The number sequence stays the same in the code which means I am now hiding rows either before (delete rows) or after (insert rows) the intended rows I want to be hidden. Is there a way to change the above code to remain with the assigned rows regardless of the adding/deleting of rows before it?

View 1 Replies View Related

Conditional Formatting: Reference Changes Adding/Deleting Rows/Columns Or Cells

Sep 26, 2006

I'm using Conditional Formatting for an entire column to check the value of each cell and compare it to the value of a cell in the same row but a different column. (Cell Value equals =$D2) It works great until I insert or delete a cell in the formatted column. The reference does not change as one would expect. I've played around with formulae such as =$D2<>$P2 but the reference only changes for the P2, not the D2. I've also tried using =CELL("contents", ADDRESS(Row(),4)) but this causes excel to complain.

View 3 Replies View Related

Complex Formulas Not Automatically Adjusting When Adding / Removing Rows?

Jul 11, 2014

I have this spreadsheet that I am creating schedules for my employees since our scheduling software at work is horrible to work with. It calculates total hours for each employee at the far right of the rows, and calculates total hours for each day in the columns. The formulas that calculate the hours for each day is set up to automatically deduct 30 minutes from a shift, for lunch, if they're scheduled for more than 5 hours (the gray shaded employee rows are for managers and that only deducts 30 mins if they're shift exceeds 8 hours).

I'm familiar enough to put somewhat complex formulas together, but I don't understand it enough to always make them work correctly. What I'm wanting to be able to do is add or subtract entire rows (add new employees or remove old), and have my formulas for calculating the total hours to still work. Right now if I delete a row the cell with the formula in it says #REF!. I can fix this by going through the formula and manually deleting everything in that contains those other cells, but the formula is huge, and it's pretty tedious going through the whole thing when it feels like there should be a simpler way of doing it.

TLDR: I want to be able to add/remove a row and have my cells currently on row 36 update the formula correctly.

View 3 Replies View Related

Deleting Specific Rows In Worksheet

Nov 28, 2006

i need to create a macro that will delete entire rows based on certain criteria. here is an example of some of the worksheet:

US0017651060AMR_CORP CM 12C
US0017658669AMR_CORP PR 8C

US00211H1077ATC_ONLANE_INC CM 92M
US00211H2067ATC_ONLANE_INC PR 100N

US0038813079ACACIA_RESH CM 12C
US0038812089ACACIA_RESH CM 16C

CA00440P2017ACE_AVIATION CM 7C
CA00440P1027ACE_AVIATION CM 7C
US00440P3001ACE_AVIATION CM 100S

CA00756J1049ADVANTEX_MARK CM 43C
CA00756J3029ADVANTEX_MARK PR 100N

i want to create a macro that, when searching the third column of data (containing "CM" and "PR"), if a group of rows (between blank rows) do not contain at least one "PR", delete entire group of rows.

Therefore, the rows with "ACACIA_RESH" and "ACE_AVIATION" would be deleted from the worksheet.

View 9 Replies View Related

Copying Cells From One Worksheet To Another And Maintaining Format

Aug 7, 2008

I have a worksheet that gets autofiltered by the user. I need take the unhidden data and copy it to a new worksheet.

Range("H18").Select
Dim sh As Worksheet
Dim Cell As Range
Dim Txt As String
For Each Cell In Sheets("Panel Check List").Range("H18:H5000")
If Cell.EntireRow.Offset(1, 0).Hidden = False Then
Cell.Copy
Sheets("Query Results").Range("A6").Select
If IsEmpty(ActiveCell.Offset(1, 0)) = True Then
ActiveCell.Offset(1, 0).PasteSpecial
End If
End If
Next Cell

View 9 Replies View Related

Adding A Variable Rows Worksheet

Mar 31, 2009

Due DateInvDocument numberDebitCreditBalance
17/09/08L01607610714211201825.44
13/10/08L01637010284345841020
13/10/08L01637131713874501020
13/10/08L016373852202473461020
13/10/08L0163748.5222E+111020
15/10/08L01641811103746832316

The above is a part of a w/sheet. Rather than determining the last row in the debit column and credit column (to know which is greater) and use a loop to put a formula in each of the cells in the balance column (adding the debit and credit), I know I can use the with ... statement to input the formula at a go , but cannot figure it out.

Sub sumtotal()
With Sheets(1)
With .Range("G14", Range("G" & Rows.Count).End(xlUp))
.Clear
.Formula = "=sum(E14+F14)"
On Error Resume Next

End With
End With
End Sub

View 9 Replies View Related

Sort Data And Auto Copy Sorted Data To New Worksheet While Maintaining WS1

Oct 7, 2013

I have an excel WS1 set up as DB; I want to keep this sheet for data revision. WS2,3, 4, & 5 will be data that is filtered and sorted, using WS1 as source so I want to auto copy the WS1 data. Can I just auto copy WS1 (how do I do that?) then filter and sort in each WS?

View 3 Replies View Related

Retain Formulas When Deleting

Dec 17, 2006

how do you store formulas so that they stay in the cells when all info is deleted? so i can use the same spreadsheet every week but all i have to do is select all and delete. if i do it now i lose al my formuals.

View 3 Replies View Related

Adding And Deleting Pictures?

Feb 11, 2013

I am working on a worksheet where users are asked by a userform combo box to select a product. When they select the product a picture of that product appears in the top left corner of the worksheet.

I have managed to get the picture to appear however delete any pictures that were in that cell before pasting a new one, cause when changes the product a picture is pasted over on top of the previous one however if the pictures are not the same size you may see the previous under the current.

delete any previous pictures. Here is the code I have so far.

Sub GetPicture()
Set Rng = Sheets("Products").Range("A2", Sheets("Products").Range("A2").End(xlDown)) '.Resize(, 10))

[Code].....

View 3 Replies View Related

Deleting Cell Values But Not Formulas?

Aug 24, 2013

I work for a bank and we use an excel spreadsheet that has an in depth payment calculator used for creating monthly payment arrangements or calculating settlements on bank loans. I would like to add the following feature and I'm not quite sure exactly how to do it.

For example, imagine cell A1 will contain the full payoff of a loan. I want to be able to put a settlement offer in B1 and have C1 populate the percentage of the payoff that is. At the same time, I want to be able to delete the settlement offer in B1 and put a percentage in C1 and have it calculate that settlement offer in B1. The calculations/formulas to do these problems is simple, but what I need is to not lose the formulas in B1 and C1 if I were to go back and forth entering settlement offers vs settlement percentages.

View 2 Replies View Related

Deleting Lines - Keeping Formulas Fixed

Sep 6, 2007

With a macro i want to delete some lines in sheet1. In sheet2 however i have formulas that point on sheet1 .. like this

=sheet1!A1
=sheet1!A2
=sheet1!A3

Now when i delete line 2, the result would look like this
=sheet1!A1
#NV!
=sheet1!A2

Is there a way to make these formulas pointing at the same cells after line two is deleted? And i do not mean a work around, with different formulas. I just want the Formulas in sheet2 to remain unchanged, regardless of what happens in sheet1...

View 9 Replies View Related

Adding And Deleting Columns, Ruins Code

Jul 21, 2008

I have a spreadsheet with 20 or so columns but that number can change at any time. I need my code to by dynamic so if a column is deleted (or added) my code will still work.

Each column has a name in row 2 and I'm trying to use that in order to make everything dynamic. For example, my code counts the number of blue cells in colums D4:G68, but now if someone adds a column before column D, everything gets messed up and it will still count the cells in D4:G68 but I want to use E4:H64 now. Does that make sense? I have made code that searches the column names and returns the column number to correspond to the name. How would I change this?

Range ("C8") = "= CountBlue(E4:G68)"

the code doesn't look exactly like this, I believe it is actually in R1C1 format

View 9 Replies View Related

Copy Worksheet In Workbook With All Formulas On New Worksheet Referencing Previous Worksheet

Apr 21, 2012

I have a workbook that contains 50 worksheets named 1-50. I need to add more worksheets. all the formulas in the worksheets always refers to the previous worksheet.

How can i make a copy of the worksheet named 50, name it 51 and have all the formulas in worksheet 51 refer back to worksheet 50?

View 1 Replies View Related

Code To Stop A User Adding Or Deleting Sheets

Aug 31, 2007

I need to stop users from adding and deleting sheets in a workbook

My idea was obviously to disable the command bars to add or delete sheets in open event and then put back in before close.

But then i thought...whats stopping them from right clicking the sheet tab and inserting a sheet, can i remove that menu to...?

I also wasnt sure if there were short cut keys to add or delete sheets.?

Some of my users use excel alot so i want to account for an tips they know that i might not.

View 9 Replies View Related

Adding Two Formulas Together?

Mar 24, 2014

how do i add this =LOOKUP((E12+G12),{0,1500,6000,15000,55000;3.4,2.9,2.4,1.9,1.4})%*(E12+G12)+0.2 Into this fomula =IF(AND(E3>0,J3="Yes"),((E3+G3)*3.4%+0.2),0)

View 1 Replies View Related

Adding Numbers With Formulas

Apr 23, 2009

I'm tring do a simple formula: =CA3+BP3+BE3+AT3+AI3+X3+M3, but because the cells I am adding have formulas in them already it is returning a error. Can I add them using 'sumproduct' formula, or is there another way?

View 9 Replies View Related

Adding Columns And Formulas And All That

Nov 6, 2008

I would now like to as remove the first column and add another column a and b. A would say "Service From Date" and column B would say "Service To Date" In addition I would like to add a column between "5202 Meals Provided" and "5221 S.A. Facility Lodging" a column that reads "7025 Number of Days Care" and that tallies like the rest of them.

View 14 Replies View Related

Adding Columns And Formulas

Dec 9, 2008

I need to editing a VBA script and can't assist right now. Here is the VBA script as it exists today:

View 3 Replies View Related

Formulas To Be Copied After Adding Row?

Dec 20, 2011

I need formulas to be automatic added when i insert row

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved