Inserting a row

S

Scott Halper

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
 
J

Joel

the best way is to use offset

from
..RowHeight = 12.75

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top