Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Insert Row also adds formulas and moves cursor

I cannot explain this behavior, which is occurring when I do the action from a macro or manually:

I have a number of cells adjacent to each other, some of which are in a named range and some are not.

My code is as follows:

Sub Renum_AddRow()

Sheets("ReNum").Select
Call UnprotectOne
Range("ReNumTemplate").Select
Selection.EntireRow.Insert
Range("ReNumTemplate").Copy Destination:=ActiveCell

Call ProtectOne

End Sub

ReNumTemplate = b29:h29.
Some of the cells include formulas that refer to Sheet 'C-Locs&AIs'.

When I insert the row, new formulas appear in the cells, but they are not just the formulas above or below with the relative references changed. For example, cell B29's formula is: ='C-Locs&AIs'!I31 & ", " & 'C-Locs&AIs'!J31 & ", " & 'C-Locs&AIs'!K31. The formula which appears after I add the row is: ='C-Locs&AIs'!D31. In another cell, the formula I expect should reference column B, but instead references column E.

And the cursor moves itself to F28, which is a few cells to the right in the newly added row.

All of this from a single command to "Insert Row." this happens regardless of whether I am using a macro, or doing the insert manually.

I have closed and reopened the spreadsheet, and even shut down my computer completely, but no joy. Is there anyone who can explain this? could this single sheet be corrected?

Would appreciate any thoughts or comments.
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 587
Default Insert Row also adds formulas and moves cursor

also you can move ActiveCell on the same row in column B with the
following code

Application.Goto Cells(ActiveCell.Row, 2)

isabelle

Le 2013-08-14 22:34, isabelle a écrit :
hi,

before copy, check that ActiveCell is part of Column B

If ActiveCell.Column = 2 Then

isabelle


Le 2013-08-12 18:23, a écrit :
I cannot explain this behavior, which is occurring when I do the
action from a macro or manually:

I have a number of cells adjacent to each other, some of which are in
a named range and some are not.

My code is as follows:

Sub Renum_AddRow()

Sheets("ReNum").Select
Call UnprotectOne
Range("ReNumTemplate").Select
Selection.EntireRow.Insert
Range("ReNumTemplate").Copy Destination:=ActiveCell

Call ProtectOne

End Sub

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
Tab key oly moves cursor to left Driftwood Excel Discussion (Misc queries) 3 June 29th 09 01:48 PM
move cursor on one sheet moves cursor on all sheets tdworden Excel Discussion (Misc queries) 2 July 22nd 07 10:50 PM
Page moves instead of cursor Ralphael1 Excel Discussion (Misc queries) 2 December 23rd 06 12:14 PM
My entire sheet moves instead of the cursor. What to do? Trying Excel Discussion (Misc queries) 2 February 20th 05 05:41 PM
Macro That Moves Cursor Down job1job1 Excel Programming 3 February 16th 04 09:44 PM


All times are GMT +1. The time now is 09:19 AM.

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

About Us

"It's about Microsoft Excel"