go to first cell of inserted row

Hello all,

I have a macro that inserts a new row.(normally don't need a macro but
I have formatted cells that need to be copied etc). But after the
insertion it leaves the active row highlighted. I would like to go to
(or select) the first cell of that new active row.

What code should I insert at the end of my macro to do this?

Thanks in advance,

Dave
0
3/30/2009 2:57:49 PM
excel 39879 articles. 2 followers. Follow

2 Replies
456 Views

Similar Articles

[PageSpeed] 11

Hi Dave

Try this:

Selection(1, 1).Select

Regards,
Per

"Dave" <Dave.Beaune@lhsc.on.ca> skrev i meddelelsen 
news:4b098e62-338d-4470-a40d-659ca91843f9@f19g2000vbf.googlegroups.com...
> Hello all,
>
> I have a macro that inserts a new row.(normally don't need a macro but
> I have formatted cells that need to be copied etc). But after the
> insertion it leaves the active row highlighted. I would like to go to
> (or select) the first cell of that new active row.
>
> What code should I insert at the end of my macro to do this?
>
> Thanks in advance,
>
> Dave 

0
per.jessen (135)
3/30/2009 3:11:59 PM
That worked!

Thanks very much.

Dave
0
3/30/2009 3:38:15 PM
Reply:

Similar Artilces:

Inserting charts into many workbooks
Hi, I'm using Excel 2007 and am pretty new to VBA. I have a folder with 40 or so workbooks- all with the same worksheet table format. The worksheets are huge (20 000 + rows, 50 or so columns). I need to open a workbook, make several fully formatted graphs, then insert the same graphs into every workbook , updated them with that workbooks' data. Any ideas on code for this? This isn't fully automated, but it will save some time. In one workbook, create the chart and format it to your specs. Then paste the chart into another workbook, and use the utility linked to i...

Convert single colum/multiple rows to multiple colums.
Hi, I have a .dat file when opened with Excel it has 1 column and 7 rows per entry. I would like to delete some rows and convert the rest to something like. Any chance this can be done. It's quite large. 51,793 rows. TIA Jeff Col 1 Col 2 Col 3 Name Date Lenny Kravitz - 2000 - Greatest Hits -- Table: {2} { "music" "Name", "06/04/2008", "Lenny Kravitz - 2000 - Greatest Hits", }, --Table: {3} etc. etc. ...

Insert an autofiltered range into another tab
I'm am having an issue when trying to insert a range from an autofilter on one sheet to another. The range has to be inserted above rows that have data in them. When I use the insert.shift:xldown, it only moves down the first column. TIA, Sub B_CreateTabs() Dim rngE As Range Dim lngLastRow As Long Dim mgrval, lobval, shtval As String mgrval = "myself" lobval = "dept" shtval = mgrval & "-" & lobval Windows("Mybook.xls").Activate Sheets(shtval).Select Sheets(shtval).Copy After:=Workbooks("Mybook.xls&quo...

Summing distinct rows in same cell
Sorry for the bad title I'm not sure hte best way to sum up this issue. Fruit Price Total Apples 0.69 40 Bananas 0.34 38 Lemons 0.55 15 Oranges 0.25 25 Apples 0.5 10 Pears 0.59 40 Almonds 2.8 10 Cashews 3.55 16 Peanuts 1.25 20 Walnuts 1.75 12 Apples 0.5 5 Given the data above I'm trying to sum the totals for only the Appl rows. So basically I need to search the Fruit column find the row that have "Apples" and then sum their corresponding Totals, giving m 55. I've been playing with this for hours with Lookups and Indexes bu am not really getting anywhere. Also, I can...

Save As using contents of Cell in Name
Can someone help with code that changes the "save As" file name to combination of the original File Name + the contents of a cell, an saves file in same folder as the original. E.G. Original File Name= Timesheet Cells B1= Location Cell C1 = Date in format 3-5-2004 Cell A1 = concatenate(B1,C1) Fle Name will therefore be "Timesheet Location 3-5-2004" The other problem is with the date. When concatenating, how do I forma the date to avoid it looking like "Location 38051" Any help much appreciated Nic -- Message posted from http://www.ExcelForum.com Hi for c...

How can I choose alternate rows in a column?
My requirement is to be able to create a column whose elements consist of difference between adjacent elements in a column, say column A. If I can choose alternate elements and create 2 new columns then I can just subtract the 2 columns easily. Huh? "pnair" <pnair@discussions.microsoft.com> wrote in message news:D47AD012-084B-49C6-8672-5067E8455D9E@microsoft.com... > My requirement is to be able to create a column whose elements consist of > difference between adjacent elements in a column, say column A. If I can > choose alternate elements and create 2 new colum...

Count on cell for each time it is changed
I would like to count the number of times a cell has been amended/ changed e.g cell b2 has the word red it it, in cell c2 i would like a counter for everytime the cell in b2 has changed, at the end of the day you get final number. Is this at all possible? Jelinek, You can do it by putting the following VBA macro in your sheet: Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address = "$B$2" Then Cells(2, 3) = Cells(2, 3) + 1 End If End Sub Art "Jelinek" wrote: > I would like to count the number of times a cell has bee...

Cells Fill Automatically on Another Workbook
I've created what we'll call a seed worksheet to be used over and over for different clients. I have linked its cells to another workbook. As the originating seed worksheet directs its cell data to a specific cell on another workbook, how can I accomplish the workbook data not being overwritten but the new incoming data default to the next unused cell in the column? i.e. If the original seed worksheet cell B1 links to the worksheet cell A1, I would like the next instance of creating a new customer and his B1 information on his use of the seed worksheet to populate onto th...

hide/change color of selected row headings
Is it possible to hide the row heading numbers for selected rows (i.e. rows 51 and greater) for just the selected sheet? I'd like to have a color with no row heading number appear that matches the fill color I select for the adjacent cells. Secondly, any ideas as to how I can prevent the user from scolling further down than a certain point (i.e. row 51). Thanks in advance. Joe Row headings are either on or off, you can't hide some. However, you can achieve a similar effect by hiding *all* headings (Tools/Options/General) and putting the numbers 1:51 in A1:A51. to limit scro...

Insert Static Date as part of Macro
I've built a nice macro, but I want it to insert the date it is run in an empty cell within the macro's range. When working within a spreadsheet, Ctrl +; returns the system date, but I can't figure out how to put that command into a macro. The macro recorder editor shows that the system recognizes the entry as the current date, not a function that returns the current date. The now() or today() functions are both dynamic ... they change with the system date. That's not acceptable in this situation. I need to seen when the macro was run. Thanks for any help, Ralph di...

Concatenating cells but excluding blanks
Hello, I am trying to create a result field, concatenating populated cells from the previous 12 columns on that line, but excluding blank cells and putting a * delimiting character between each instance - please find below a 4 column example. ID 1 2 3 4 Result Z A C D A*C*D Y B C B*C X A B D A*B*D Each of the 10,000 lines of the spreadsheet is different - there are at least 5 blank cells on each line Any help gratefully received. I am working in Excel 2007 Many thanks. Bob Try this: http://img690.imageshack.us/img690/5826/nonamee.png Micky "Bob Fr...

How to insert a URL with spaces into message body
Is it possible to insert a URL containing a space into a message body from a mailto hyperlink without using brackets? For example: <a href="mailto:jackblack@microsoft.com? body=<http://www.micro% 20soft.com>">jackblack@microsoft.com</a> This link will insert the URL '<http://www.micro soft.com>' (with a space between the 'o' and the 's') into the message body. However, the brackets will be visable too. If I remove the brackets, only the 'http://www.micro' portion will be hyperlinked. The 'soft.com' portion wi...

Can't insert rows
I am using Excel 2007 and have just loaded a spreadsheet created in a previous version which is running in Compatibility mode. When I try to insert a row I get an message "Cannot shift objects off sheet". How do I insert rows on this sheet? No problem with another workbook loaded at the same time which was created in 2007. See if this helps http://support.microsoft.com/default.aspx?kbid=211769 "Cannot shift objects off sheet" error message when you hide columns in Excel -- --- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my...

Copy Data from One Group of Cells to Another Group
I have five columns of data on two different sheets in the same workbook. One set of columns is sorted in ascending date order the other in descending date order. When I enter data into the last row of Sheet 1, I need the data in that row in columns A, B, C and D to be copied into Sheet 2 columns A, C, D and E in a newly inserted row 14. Is this possible with the use of a macro? I can find the last cell in Sheet 1, but then need to go up one row and back to column A. I am having difficulty with that. Thanks is advance for any assistance offered! /s/ Alan Auerbach On Sat, 26 May 2007, ...

Copy cell contents, then paste into the same cell with other text.
Hi! I tried a search first and couldn't find anything like this. My spreadsheet has a column for shipping that takes a series like this for each product: ?0.0*0.13.2*d*0x0x0:07:24:04 Following the question mark is the handling charge (0.0 in this example). This is followed by an * and then the weight of the item (0.13.2 in this example which is 13.2 ounces) I have a list of product weights in a colum with just pounds and ounces. I need to copy that information, then paste it into the weight area of the string above and then paste those modified contents back into t...

How to select other random cells
I have a 2 part question. I want to have a 1 question survey randomly filled out by 200 people. Column A lists the 1 questions. Columun b has ABCDE listed in cells B6 to b10. I would like 200 samples in columns c, d, e, etc. How do I set this up so that they randomly Coose B6 to B 10. Second part. On another spreadsheet, I have a similar situation, but the user has 10 answers to select from and I want them to randomly select all that apply. How would I do this? Thanks! ...

Inserting dashes to an existing number
Hi, I am trying to create a formula that will divide this ten digit numbe into the following dashes. Here is the number 1234000999 I need the dashes to be inserted in thi format 1234-000-999. What is the appropriate formula. Thanks for your help. Dinahros -- dinahros ----------------------------------------------------------------------- dinahrose's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=1334 View this thread: http://www.excelforum.com/showthread.php?threadid=26643 Why not just custom format right click on selection>format>number>custom...

Number Rows on a report?
It would be anice addition if I could add numbers (a count) in front of each row on my filtered report. Any easy way to do this. I was thinking an unbound text box with something in the control source - I just don't know the something :) Any help here will be appreciated. Thanks in advance On Wed, 20 Jun 2007 14:07:27 -0700, Dave wrote: > It would be anice addition if I could add numbers (a count) in front of each > row on my filtered report. > > Any easy way to do this. > > I was thinking an unbound text box with something in the control source - I > just...

How do I call individual cell data from an Excel sheet into Powerpoint or Word?
Ok, I have an Excel work sheet done up to calculate discounts given to employees based on their employer. I now need to make a flyer in either Word or PowerPoint (or another program if needed) but I'd like for it to pull the data from individual cells in the Excel sheet. For instance in the midst of the graphics and flyer text that will remain the same for every flyer I'd like to be able to tell it to refer to Excel document, and then pull all the information for say, the company in row 7 (since 7 is the first company listed) It would need to pull the text (co. name) from A7, sug. r...

Cell padding
I have a worksheet with multiple row heights. When I do autofit some of the words are being cutoff in the rows. How can I adjust to a little extra space in each cell without manually adjusting each row? I'm assuming that the words are being cut off from left to right (not top to bottom) - I am not sure from you posting. If the above is the case, in EXCEL 2007, try the following:- - click in the cell to the left of column A and above row 1 - this will highlight the whole Worksheet - then double click the line between the A and the B column headings The above wi...

insert data into chart
I have a chart that refers to a certain range (for the sake of arguement, let's say "A1:C5") for its source data. I now want to insert more data. Say before row 2. So I do a row insert, then add my data. So now the range the chart SHOULD look at is A1:C6. But it doesn't. Now it looks like "A1:C1;A3:C6". Is there a way to have a chart automatically include the inserted row? The real-world problem I'm working on has LOTS of charts already made. Their source data is a direct references to cells on another sheet. I need to update all of these charts w...

Copy cell to a new cell #2
In Column B I have certain values which start with GB2 e.g GB2-02210. I would to like to copy these values and paste it in another cell. I would like to do this with only values which start with GB2. Many thanks -- Message posted via http://www.officekb.com I would use Data>Filter>Autofilter and use custom>begins with... -- HTH Nick Hodge Microsoft MVP - Excel Southampton, England www.nickhodge.co.uk nick_hodgeTAKETHISOUT@zen.co.uk.ANDTHIS "mohd21uk via OfficeKB.com" <u20517@uwe> wrote in message news:5ede27c5beb13@uwe... > In Column B I have certain values ...

Can I use sp w/ parameter as row source for a combo box?
I have a working stored proc that takes one parameter and gives me exactly what I need for populating a combo box. The stored proc does sums on the results of a UNION query with 3 very distinct components - the only variable is a 'region_id' parameter. Is there a way to reference the sp as the combo box source and pass in the parameter? I have no problem with tweaking the cbo's properties at run time. If not, then I guess I could define the view to do the summing with the region as one of the GROUP BY's and then in the front end write SQL to only grab the summed ...

Error Cells
If I have a formula in cell A3 say "=A1/A2" and A2 = 0, i obvioulsy get a "# DIV/0!" in A# im wonderin if there is an excel function that will turn an erro message into some other text, say a zero, or something of my choice And if not, is there a way i can make my own excel function that doe this thank -- Message posted from http://www.ExcelForum.com Hi in your case you can change the formula to =IF(A2=0,"Errortext zero",A1/A2) Frank if you get the divide by zero error a solution can be: IF(COUNT(myRange)<1,"no data",(myRange)) Where the �f...

data validation
Hi A little while ago I posted a question on how to get a multiple option dropdown using the data validation option (unfortunately I can't seem to find the thread). The solution suggested worked great. The user select an option in the dropdown at the top of the spreadsheet which then altered the options available in the rest of spreadsheet. Example Select Option A at the top and only 1,2 and 3 are available in the dropdown. Select Option B and only 4,5 and 6 are available. It used the following code in the data validation: =OFFSET(ActivityStart,MATCH($B$3,ActivityCol...