Hit Tab Button To Insert New Line And Preserve Previous Lines Formulas
Feb 23, 2014
I am brand new and I don't know a ton about macros and programming in Excel.
What I'm trying to do here in this attached spreadsheet is at the end of inputting my line, I want to hit the tab (marked in red to make it clear where) button in the cell and have it automatically create another blank line but keep the formulas the same.
Basically I just want to avoid having to right click and insert line and then drag the formulas column by column down which is difficult.
See attached : TEST2_2014 Sales & Commission Spreadsheet.xlsx‎
I have a simple command button in my worksheet that will insert a blank row and copy formatting, but not the formulas. How do I adjust the code so that the formulas are copied to the new blank row? This is currently what I have:
Private Sub CommandButton2_Click() Sheets("WAWF Track").Range("A9").Select ActiveCell.EntireRow.Insert Shift:=x1Down End Sub
I have been using this code and just noticed that it resets all of my options buttons to false when I exit and then re-enter (activate) the sheet with the option buttons.
I see where this is going on, but don't know how to correct it. I only want the option buttons changed to false if
The Sol named range is something other than "Primary Vendor". It seems to call the macro ClearOB whenener the sheet is activated.
Private Sub Worksheet_Activate() If Range("Sol").Value = "Primary Vendor" Then For Each OB In ActiveSheet.OptionButtons OB.Enabled = True Next OB ClearOB ActiveSheet.ScrollArea = "A1:K58"
I have a spread sheet with product codes on and 5 different prices types but they have only pulled through 4 times so need to insert a 5th line for each product code
Creating a macro that will identify the last blank line in column J and insert a line in it? The macro will need to look from the "bottom" as there is blanks cells above the last line.
I need to create a line graph that has 2 lines for each person, one with the amount, one with the points. The X-Axis is by Weeks going up. How can I do this without making a separate series for each? I've attached an example.
I have some code below. I have error handling in place for when it tries to open a specific file. If it isn't there then user has option to continue and ignore this file, or browse and select a new one.
The problem is, when the user wants to ignore the file, the "Resume Next" continues to run the VBA assuming the file was ok i.e. the code after the line to open the file. What I would like is for it to skip the succeeding code and go to look for the next file.
Below is the VBA:
Code: For i = 0 To 2 Step 1
'add in error handling for if the file is missing On Error GoTo MissingFile Workbooks.Open Filename:="\hbeu.adroot.hsbcdfsrootgb002hfcfinance01fnce" & qfolder & "Data" & qfile(i), UpdateLinks:=False, ReadOnly:=True
[Code] .........
Missing File:
qMissingPrompt = "There was an error opening data file. Click OK to browse or Cancel to ignore and move to next file" qAns = MsgBox(qMissingPrompt, vbOKCancel) 'click cancel - ignore error and move onto the next file If qAns = vbCancel Then
[Code] .......
So, where it says Resume Next, currently it will start running the following (after On Error Goto 0)
Code: Set datawb = ActiveWorkbook
range("A2").Select Do Until ActiveCell.Value = "" etc.
What I would like it to do is go back to is to go to the next i
Code: For i = 0 To 2 Step 1
Or even to go to the 'Next' statement at the end so that it moves onto the Next i and tries to open the next file.
I import data into an excel spreadsheet where a unique job number may have multiple costs against it. These import as separate lines, repeating the job number.
The data imports on a sheet called 'DataImport'. From that sheet I transfer some of the imported fields onto another sheet.
What I need to be able to do is transfer the job number and a sum of the costs onto the other sheet.
The data is run regularly and I delete all the fields on the DataImport sheet in the macro each time the import is run.
I have 2 lists of codes with values tied to them, columns A & B, and columns C & D. Column A is a list of the codes in use, and column C is every code possible, I need to line up the codes and shorten column C to match column A, while retaining the value that is tied to each code so that I can compare Columns B & D easily.
I have been trying to chart temperature differences over 10 day's time for six cities using a line graph. For some reason, the lines are all clustered at the bottom of my graph, with values of 0. My spreadsheet is accurate, without any blank cells. I'm using Excel 2010.
One has around 129 lines for the first years 2006 in sheet1. The other links to the first 129 rows. Then I've linked the top 129 in sheet2 130 down for 2007 and so on for 5 years.
How would I add a line in Sheet1 then would insert 5 lines in sheet2 keeping the same order.
e.g
Sheet1 Name Rev Year John £120 2006 Row 5 Jack £150 2006 Row 6
Sheet2 (linked) Name Rev Year John £120 2006 Row 5 Jack £150 2006 Row 6 John £130 2007 Row 134 Jack £160 2007 Row 135 John £140 2008 Row 263 Jack £160 2008 Row 264 John £150 2009 Row 392 Jack £170 2009 Row 393 John £155 2010 Row 521 Jack £180 2010 Row 522
Adding ' in the beginning of a line converts the rest into comment line. I wonder if there is an easy way to convert a huge area into comment line to try something on code. I couldn't find such an option in the menu.
Im creating a template for a number of sheets and I want the hyperlink for my previous/next buttons (to move forward and back through sheets) to change based on cell values.
All my sheets are named as numbers ie '1','2','3' and so on
The name (and therefore number) of the sheet is held in cell E22 on each sheet.
The 'previous' button needs to therefore hyperlink to cell A1 on sheet (E22-1) and the 'Next' button to cell A1 on sheet (E22+1)
The 'buttons' I have though are arrows from Excels shapes and I dont know how to add code to them though to start the hyperlink.
Also if i wanted to reference sheet E22-1 etc in a HYPERLINK() function what is the syntax?
I am working within a workbook with many worksheets and I want the ability to go back to the previous sheet I was on (example - I am on sheet 23, go to sheet 16, I want to be able to have a button or link that takes me back to sheet 23)
My current code works, but there's got to be a shorter version to insert rows based on a cell value. Currently my code works on a series of If statements. If the value in the current cell is "2" then goto the next row and insert one line. If the value is "3" then go to the next row, insert, next row insert etc. I'm currently written up to a value of 10, but the coding is getting longer and longer. Anybody got a shorter loop that I could use.
I ma using exel 2007 and I tryed to use this codes,I need faster to finish this project
Soo I have done only 2 buttons OK and Close the tab works like this I CLICK "Kerko" and then I write the name that I want to search in my Phonelist and when I click Ok it shows me his surname his telephone name and his City prephix
But the next and previous button I cant make them work,soo when I have to click next the name down the name that I first wroted will apear with his surname telepphone name and city prphix,and when I click prevoious will happend the same think but will not apear the next persone but the previous.
I'd like to make a template so that when it is opened the previous month name is inserted in the sheet name. The reason I want to use previous month is that normally this report is created in the month following the month being reported. So it is opened, months are updated, then the user saves as xls. Ideally I guess sheet would not have the month on the template.
The name of the sheets are shortened months like "Dec Results Bob" and there are 8 of these.
I can tell it might start:
Private Sub Workbook_Open() (or would .xlt be the same?)
but that's about it. I made a macro of renaming sheet but that didn't really tell me if I could insert the Month there.
I have a very large table with 7000 rows and each time I open the file it takes excel about 1 minute to open it.Initially all cells in the rows are empty. Each row in the table has the same formats and formulas(eg. in J106 I have =IF(C106=1,1,"") and in J107 I have =IF(C107=1,1,"")).So the excel allocates all the memory and does the formatting and computations beforehand. How can I add new rows(preserving the formats and formulas of previous ones) dinammycally and automated? An example will be if I start enter data in a row add another row at the end of the table or a button that when I press it adds lets say 100 new rows in the table. Below is the table, the rows in the table to which I add data start form C15 to C7014.
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...
I want to add a user-form on a chart, which will have check-boxes that will allow me to select series(lines) that I want see and compare in a chart. Currently my line chart has 24 series (Lines) which makes the chart very difficult to view and looks very busy. How do I add list of check-boxes that will allow me to select one or multiple lines that I want to see at a time?
I merged about 15 adresslists from media contacts to one excel list. Each list had a name i.e. music, health, theater, etc. and the same logic in colums. I added a few columns and have 1 large list now.
As some journalists write about music & health & theater, architecture, etc. they are listed up to 10 times in the new list now. But the "genres" from the original list i.e. music, health, theater, etc. are in different columns. Some of the lines have empty fields (i.e. no address or mail)
All I want to do is have one line with all the information of all 10 lines in it, merged, dupes removed:
company - firstname - lastname - Adress - Mail, etc. : genre: music - health - theater: example.xlsx
I atteched an example of the full list and the result i want
I have code that works well to insert a blank row. I need to remove all vertical lines each time it adds a row. You can see I commented out the line I tried.
Sub InsertRow() Dim LstRw As Long, ChkRw As Long LstRw = Cells(Rows.Count, "A").End(xlUp).Row Application.ScreenUpdating = False
For ChkRw = LstRw To 6 Step -1 If Cells(ChkRw, "A") Cells(ChkRw - 1, "A") Then Rows(ChkRw).EntireRow.Insert 'Selection.Borders(xlInsideVertical).LineStyle = xlNone End If Next ChkRw
I have a spreadsheet that I have people fill in. A few columns have VLOOKUPS. I want to allow people to insert lines in this spreadsheet and have the formula automatically copy in the new line. It seems to already have that behavior for formatting and conditional formatting. Is there a way to also have that for formulas when inserting lines?
Name City Assigned Salesman ----------------------------------------------------- john Mountain View (formula using VLOOKUP) cindy Palo Alto (formula using VLOOKUP) ronnie sunnyvale (formula using VLOOKUP) ---------------------------------------------------
Insert line between john & cindy. Formula doesn't copy.
I ask them to copy the formula but they often forget. If I can make it a little more robust,