Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 53
Default Selecting a cell in a row just inserted in a range.

I'm trying to select a cell in column 2 of a row that is just inserted into a
range using a macro. After searching the group discussion, I found and
modified this script to actually insert the row. I now need to modify it to
select the cell (make it active) in column 2 of the row that was just
inserted. This macro is started with a button and the active cell could be
anywhere when the button is pressed.

Here's the code I'm starting with to insert a row:

Dim DGrng As Range
Set DGrng = Range("DG")
Set DGrng = DGrng.Rows(DGrng.Rows.Count)
Sheets("Preliminary Report").Unprotect
DGrng.EntireRow.Insert
Sheets("Preliminary Report").Protect


Thanks in Advance!
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 53
Default Selecting a cell in a row just inserted in a range.

Thanks Don,

I said "select", maybe needed to say "activate". Basically, I'm setting it
up so that information can be placed into the new row that comes from three
InputBoxes.

But... that's all moot now. I'm now getting an Error 1004 "Insert method of
Range class failed" on this code and another code that I haven't changed.

Don't know what happened; but something did. The code was working fine last
night.

"Don Guillett" wrote:

Try this. Be advised that it is almost always NOT necessary to select
anything.

Sub insertrowandgo()
Cells(Range("myrng").Rows.Count, 2).Select
Selection.EntireRow.Insert
End Sub

--
Don Guillett
SalesAid Software

"Shannon" wrote in message
...
I'm trying to select a cell in column 2 of a row that is just inserted
into a
range using a macro. After searching the group discussion, I found and
modified this script to actually insert the row. I now need to modify it
to
select the cell (make it active) in column 2 of the row that was just
inserted. This macro is started with a button and the active cell could
be
anywhere when the button is pressed.

Here's the code I'm starting with to insert a row:

Dim DGrng As Range
Set DGrng = Range("DG")
Set DGrng = DGrng.Rows(DGrng.Rows.Count)
Sheets("Preliminary Report").Unprotect
DGrng.EntireRow.Insert
Sheets("Preliminary Report").Protect


Thanks in Advance!




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 53
Default Selecting a cell in a row just inserted in a range.

Shannon says to hisself, "Doh! Unprotect the sheet moron!"

But... that's all moot now. I'm now getting an Error 1004 "Insert method of
Range class failed" on this code and another code that I haven't changed.

Don't know what happened; but something did. The code was working fine last
night.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Selecting the first cell of the last row in a range Susan Ramlet New Users to Excel 5 April 3rd 09 04:35 PM
Selecting range in list of range names depending on a cell informa Courreges Excel Discussion (Misc queries) 2 June 19th 06 10:59 AM
Selecting a cell in a range Coolboy55 Excel Worksheet Functions 0 August 31st 05 07:17 PM
Selecting a Cell inside a range Bernie Deitrick Excel Programming 0 August 4th 04 06:56 PM
Selecting a cell range peterG Excel Programming 2 January 14th 04 05:55 AM


All times are GMT +1. The time now is 06:34 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"