Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Inserting a row

I have written some code in order to be able to lock the file but have
a macro insert a row when needed. I am having a problem because each
time the row is inserted it is hidden so I would like to have the new
adjusted row's rowheigh set so that it will be able to be seen. I
have posted my code so far below. Thanks in advance of your help.

I believe that the RowHeight has to be used in conjuction with the
Rows object. I'm just not sure how to have excel select the new
inserted row (which is directly above NFP_Insert). I thougth about
having it find the row number of NFP_Insert and then subtract one to
find the newly inserted row, however, I was unsuccessful at that as
well.

Private Sub NFP_Blank_Click()
Const PWORD As String = "123456"
Application.ScreenUpdating = False
With Worksheets("Southeast - NFP")
.Unprotect Password:=PWORD
.Range("Dist_Blank_NFP").Copy
.Range("NFP_Insert").Insert Shift:=xlUp
.RowHeight = 12.75
Application.CutCopyMode = False
.Range("Total_NFP").Select
.Protect Password:=PWORD
End With
Application.ScreenUpdating = True
End Sub

Thanks,
Scott
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Inserting a row

the best way is to use offset

from
..RowHeight = 12.75

to
..Range("NFP_Insert").offset(-1,0).entirerow.RowHeight = 12.75


"Scott Halper" wrote:

I have written some code in order to be able to lock the file but have
a macro insert a row when needed. I am having a problem because each
time the row is inserted it is hidden so I would like to have the new
adjusted row's rowheigh set so that it will be able to be seen. I
have posted my code so far below. Thanks in advance of your help.

I believe that the RowHeight has to be used in conjuction with the
Rows object. I'm just not sure how to have excel select the new
inserted row (which is directly above NFP_Insert). I thougth about
having it find the row number of NFP_Insert and then subtract one to
find the newly inserted row, however, I was unsuccessful at that as
well.

Private Sub NFP_Blank_Click()
Const PWORD As String = "123456"
Application.ScreenUpdating = False
With Worksheets("Southeast - NFP")
.Unprotect Password:=PWORD
.Range("Dist_Blank_NFP").Copy
.Range("NFP_Insert").Insert Shift:=xlUp
.RowHeight = 12.75
Application.CutCopyMode = False
.Range("Total_NFP").Select
.Protect Password:=PWORD
End With
Application.ScreenUpdating = True
End Sub

Thanks,
Scott

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
inserting zero dfg Excel Discussion (Misc queries) 3 May 22nd 06 12:37 PM
Inserting row umba-sr Excel Discussion (Misc queries) 3 April 13th 06 03:56 PM
Inserting a row Tom Excel Worksheet Functions 8 January 31st 06 12:28 AM
Inserting a Row after a name eternalrsx Excel Programming 1 June 23rd 05 04:04 PM
Inserting a Row with VBA Thomas M Excel Programming 7 November 29th 03 05:33 AM


All times are GMT +1. The time now is 10:15 PM.

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"