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 Complete Thread with Replies
Sponsored Links:
Related Forum Messages:
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 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
Last Used Row In Named Range
I have a named range (name is IncidentList, the actual range is A5:H500) that I'm trying to find the last used row in, then apply a border to the left and right of the row (eg: apply a border to the left of A1 and the right of H1). Normally I would just find the last used cell in column A, apply a border to the left, then find the last used cell in column H and apply a border to the right. The difficulty I'm having is that column H will not always have a value, so selecting the last used cell in column H may not necessarily take me to the last cell within the range I've tried something like: Range("IncidentList").Select Range(Selection, Selection.End(xlUp)).Select
View Replies!
View Related
Macro To Add Row In Named Range
Macro to add in a row in a named range, at the bottom of the range. the code i currently add in only to a certain row i need to add into a named range at the bottom. Sub AddPersonnel() With Sheets("DOR") .Unprotect Password:="techedit" Rows(56).Insert Rows(55).Copy Destination:=Range("A56") .Protect Password:="techedit" End With End Sub
View Replies!
View Related
Copy Named Range To Row Beneath Last Entry In Another
I have a number of named ranges on seperate sheets. As I add more entries to each sheet, the named range is naturally increasing so I dont have a fixed cell refence Effectively what I would like to know is - is there coding that would allow me to copy one named range - and paste the values to the the row beneath the last entry in a second named range. Filtering these I can do - it is just the copying that has me stumped
View Replies!
View Related
Define Range Based On Named Row And Column
I would like to name a range based on a row number and a column number. I have found the row and column number using this code, but I can't seem to get the rest right. Sub LastRowCol() Dim intLastRow As Integer Dim intLastCol As Integer Dim ws As Worksheet For Each ws In Worksheets intLastRow = ws.Cells.SpecialCells(xlCellTypeLastCell).Row intLastCol = ws.Cells.SpecialCells(xlCellTypeLastCell).Column
View Replies!
View Related
Plot Each Selected Row Range As Series In Scatter Chart
I need to plot multiple series in a scatterplot. The problem is that the number of series is user-defined. And also, the number of data poitns in each series is different. I've looked it up already, but a lot of the examples i've seen don't account for the fact that I need to run through a loop and add series into my graph. In other words, i need a way to select a certain range each time it runs through the loop, and add the data as a series into the chart. Also, the user enters how many series there are, so I use that as a counter
View Replies!
View Related
Insert Row, Paste Range
I've created a named range (A500:AB500) called "RowTemplate_C" This row only contains specific formatting which I would like to use throughout my workbook. How can I create a macro function whereby: When I select a cell or row, and click a button (called "InsertRow_C" ), This inserts a new row, and pastes the named range there. I've recorded my actions and made several attempts .. but my knowledge in VBA is, as you can see, quite limited. Sub Macro1() Selection.Insert Shift:=xlDown Range("RowTemplate_C").Paste End Sub
View Replies!
View Related
Insert Row & FillDown Range
On sheet "Kilo" I have 2 command buttons one "insert" and one "delete". I would like the insert button to work as if it was being utilized as if it was still on the "Nom roll" sheet. If I use the button on kilo as is it messes up the Kilo sheet.
View Replies!
View Related
Copy Named Range Chosen From Drop-Down & Paste To Last Row
I am a trainee dermatologist. We undertake allergy patch tests. There is a long list of different patch tests which are selected based on the patients history. I have put each of the types of patch testing on a master sheet. What I would like to be able to do is to have a control button next to each set, and when clicked would add that particular set to a "new patient" worksheet tab. And with every set having its own button, more than one set could be added to a new sheet. In the new patient worksheet id like the sets added with a single row gap between them. I had tried, and managed to get a single series to work, but then it wouldnt allow me to add the next set, saying that sheet already exists. Ideally finally, id like there to be some way, or message to make sure after printing the new patient worksheet gets deleted. I hope that all makes sense ! Even if I had a code for a single button that added to a master sheet at the next available row +1 I think I could manipulate the code to suit.
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
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
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
Selected Cell Within Named Range?
I want to use the Worksheet SelectionChange event to update part of my worksheet/UI depending on what cell(s) the user has selected. As an example, if I have two named ranges - $A$1:$B$10 and $C$1:$D$10 - I want to detect whether the user is in range 1, range 2, or neither, then update elements of the UI.
View Replies!
View Related
Insert Row Then Copy Row Below
The posts I have found regarding inserting rows and copying formulas etc. and their answers do not seem to work in my worksheet. All I would like to do is insert a row then copy the row below into the new row. I have tried to modify the VBA given in similar posts and cannot seem to make it work.
View Replies!
View Related
Insert Row And Copy From Above Row
i have a excel spreadsheet named "ECN Number". in this sheet i have a row in which column5 marked with value "x",column22 is empty " " and column23 has "some value". if the above statement is true,i want to insert an entire blank row and i want to insert another row below this row below the empty row with column6 marked as "x",column22 empty " " and column23 with the samevalue from the above row. after inserting this row with these values, i want to insert another entire blank row. i have attached the workbook with the specified sheet.
View Replies!
View Related
Find Last Row Containing Value, Then Insert Row After
I am creating a worksheet of contacts and the date and time that I phone them, along with their current "status" in our company. I have created a form and have got it to do the insert of new data that I input, BUT What I would really like is enter a "client number" (which is unique) and have it search my table for any record(s) with that client number, and then show me the last record that matches the client number, (this can all be done from within my form) then If I click on the "insert" command button, I want it to insert a new row after the current row and move my form data in the form into the new row which will include a date and time. So, To summarize.....I need 2 similar subroutines. LOOKUP ----- I need to have my form scan down the data for a match in a particular (pre-sorted) column, stopping at the last line that matches, then display the data or display nothing is there is no match. INSERT ----- I need to have the form scan down the data for a match in a particular (pre-sorted) column, stopping at the last line that matches and then insert a blank row here and move my data into it.
View Replies!
View Related
User Selected Range
I have a form that asks at what row the user wants to start with a selected range then how many rows to select. There will always be 21 columns selected with this range. I am still learning but it has to do with something on how I am setting the Start object. It is not being recognized. Dim Row As Long Dim Selection As Long Dim Start As Range Row = txtStartRow Selection = txtHowMany Set Start = Range("A" & txtStartRow).Select Range(Start & ActiveCell.Offset(Selection, 20)).Select
View Replies!
View Related
Insert Total Formula Using SUMIF And Named Range
I am trying to put a SUMIF formula at the bottom of the data. Doing it manually is fine, but I want some vba to automate it, and my vba doesnt work. Sub balance() 'adds journal line so journal balances in each month Dim Rga As Range Dim Rgb As Range Dim Rgc As Range Dim Rgd As Range Dim Rge As Range Dim Rgf As Range This code just inserts text into the formula, rather than the range of cells.
View Replies!
View Related
Non-Continuous Range In Event Code: Show A UserForm When A Cell In 1 Of 31 Named Ranges Is Selected
I am using the following Selection_Change Event to show a UserForm when a cell in 1 of 31 named ranges is selected. Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Target.Count > 1 Then Exit Sub Dim i As Long For i = 1 To 31 If Not Intersect(Target, Range("StatPost" & i)) Is Nothing And Target.Value = "" Then If Target.Offset(0, -8).Value = "" Or Target.Offset(0, -7).Value = "" Or Target.Offset(0, -6).Value = "" Or Target.Offset(0, -5).Value = "" Or Target.Offset(0, -3).Value = "" Or Target.Offset(0, -2).Value = "" Or Target.Offset(0, -1).Value = "" Then....................
View Replies!
View Related
Is There A Macro To Transfer A Row Of Data From Top To Bottom Row Of Range ?
I have a s/s encompassing over 350,000 rows. Data consists of a series of ranges from columns A:N and rows varying in number between 3 and 30. There are two blank lines between each range of data. Each range is (with exception) numerically ordered down column H (e.g, 1, 2, 3, etc). Problem: there are around 1100 occasions when a range contains a row of data which is to be disqualified from consideration. On these occasions the data always appears in the top row of the range and is identifiable in column H by the nine codes 111, 222, 333, 444, 555, 666, 777, 888, and 999). I wish to find a macro which will : 1. where the top row of a range in column H is one of the codes 111 to 999, transfer that row of data to the bottom of the range. 2. delete the now empty top row from which the transfer was made from. 3. insert a new blank row at the bottom of the range below the row which the data was transferred to (in order to maintain the two blank rows above and below each range).
View Replies!
View Related
User Forms Basics - Text Boxes To Named Range
User Form Basics - Populating Text Boxes. A few tweaks later and its reading the data just fine. Some of the specific form objects and range names have changed, but it's the same logic. Anyway, this isn't just for display. I need to export the data back to the spreadsheet. So, I plugged this line into the event handler for the "Save & Exit" button on the sample form in the other thread:
View Replies!
View Related
Color Row Range Based On Cell On Same Row
I have an excel sheet in which i have a cell A11 with drop down list values=YES/NO. Now based on the value in this cell i want to fill color in the cells(B1 to B10) i.e for e.g. if i select YES in the cell A11 then the cells(B1 TO B10) should become green in color. Attached is an sample of what i want.
View Replies!
View Related
Insert New Row Above A Row
How can I insert a row immediately above a row containing the term "Score" in column B that is say cell B9 contains the term "Score" then on running the macro it will insert a row at row 9 and will pull down the row containing "score" to row 10 and so on. Can a macro to this be provided?
View Replies!
View Related
Highlight A Selected Row
just bought a 22" wide screen monitor and when working in excel it's difficult to follow from left to right in a row i am looking at. i have 22 columns of info that are in view at any given time. the row number on the left gets highlighted and the cell i happen to be in is outlined with a double line border. is there a way to get the whole row outlined like the single cell? i know i can achieve this by clicking on the row itself, but i tend to move a lot around the spreadsheet via the arrow keys.
View Replies!
View Related
Deleting A Selected Row
I would like to run a macro that will delete the selected row in a protected worksheet but only delete it if the row does not have locked cells. I want users to be able to delete the rows they no longer need but only be able to delete them if the row does not have formulas that are locked. BTW-I am working in an older version of Excel.
View Replies!
View Related
How To Goto First Column Of Selected Row
i know the keyboard shortcut for doing this is End + arrow key... but wat if there are value in between for example Cat..""..""..""..""..""..""..""..5.."".."" hitting the End + arrow key from the very end will move selection to value 5... there are empty spaces in between.. 1. is there a way to convert the blank spaces in excel to 0 as default value. 2. is there any other keyboard shortcut key to reach to Cat without inturrupting 5 in between..
View Replies!
View Related
Check Whether Entire Row Has Been Selected
I have a button on an excel sheet call 'Delete Row' where I want to put code underneath so that a user can delete an enirerow. I have the Selection.EntireRow.Delete Shift:=xlUp at the moment but I want to check that the user has selected the entirerow before I delete it.
View Replies!
View Related
Populate Selected Row From Form
Thought it was better to start a new thread than to continue the old one since the focus in that thread was to get the values into a form and the question this tme is to get the values back into the correct row. Background. My little application does the following... In Form1 the user adds information that is inserted as a new row in my excel sheet. A unique ID is created and inserted in column A. In Form2 the user sees a listbox with the rows in the excel sheet. The user then selects one of the rows and get all the information including the ID displayed to him/her in Form3. In Form3 the user should then be able to update the values (except the ID) and then the values should be inserted back into the excel sheet in the correct row. I suppose I need the code behind my OKbutton to say something like If Column A = value of IDBox, insert values in columnB, columnC etc... But how do I write this code correctly?
View Replies!
View Related
Auto Filter On Selected Row
After posting a thread regarding sorting issues with multiple columns (under the thread heading "Bulk Sorting" I have conceded that unless I have a sort filter on every column I will not be able to keep data in respective rows when sorting. My new plan of attack is to insert an empty row (it will be row 13) and apply auto filter across every column (not what I wanted visually but no other option). Is there a way that I can do this at row 13 on an almost completed sheet? I may just be dumb but I can't stop the filter applying itself to row 1. If I select the whole of row 13 the auto filter or "right click - apply filter" options aren't available. If not I could start a fresh sheet. Is there a way to copy and paste a large amount of cells with different width columns into a new worksheet?
View Replies!
View Related
Select Row Where Only 1 Cell Is Selected
I need to delete part of the row where one cell is selected. If more than 1 cell is selected, I want a msgbox. Example: I have any cell selected on row 26. I want to select all cells in this row including column C thru column AD. Column A & B are not to be deleted. After the selection is made, I want the row deleted and the below cells moved up.
View Replies!
View Related
|