Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
inserting zero | Excel Discussion (Misc queries) | |||
Inserting row | Excel Discussion (Misc queries) | |||
Inserting a row | Excel Worksheet Functions | |||
Inserting a Row after a name | Excel Programming | |||
Inserting a Row with VBA | Excel Programming |