Hi All,
I have some Form Buttons on an excel sheet that are assigned macros etc. I've locked them to their current sizes, unticked them so they don't print and selected them not to move or resize with cells.
Now, when I execute the below code the 2nd time it doe's some random resizing\moving of these buttons:
If I unprotect the sheet and insert rows manually it behaves, the same with copying rows and inserting them however, using the macro seems to create this problem and I've stared at it till I'm blind and can't see what is wrong with the code (or me for that matter ).
If anyone has any pointers of can help I'd be very grateful.
Thank you for your time,
Mark.
I have some Form Buttons on an excel sheet that are assigned macros etc. I've locked them to their current sizes, unticked them so they don't print and selected them not to move or resize with cells.
Now, when I execute the below code the 2nd time it doe's some random resizing\moving of these buttons:
Code:
Sub Insert_Line_Pre_Deployment_Preparation()
Dim FindString As String
Dim Rng As Range
With ActiveSheet.Unprotect
'Enter Search Value between the ""
FindString = "1.1"
If Trim(FindString) <> "" Then
'Set The Search Range Between The ""
With ActiveSheet.Range("A:A")
Set Rng = .Find(What:=FindString, After:=.Cells(1, 1), LookIn:=xlValues, _
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlPrevious, _
MatchCase:=False)
'Moves To The Cell With The Value In
If Not Rng Is Nothing Then
Application.Goto Rng, True
'Copys The Row Specified
Sheets("Format Control").Rows(19).Copy
'Inserts The Row Copied Above Beneath The Row Found With The Value In
Rng.Offset(1).EntireRow.Insert
'Moves The Active Cell 1 Row Down and 2 Cells To The Right
Rng.Offset(1, 2).Select
Else
End If
End With
End If
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True, _
AllowInsertingRows:=True, AllowDeletingRows:=True
End With
End Sub
If I unprotect the sheet and insert rows manually it behaves, the same with copying rows and inserting them however, using the macro seems to create this problem and I've stared at it till I'm blind and can't see what is wrong with the code (or me for that matter ).
If anyone has any pointers of can help I'd be very grateful.
Thank you for your time,
Mark.