dannyok90
Board Regular
- Joined
- Aug 30, 2016
- Messages
- 115
Hi All,
The code bellow is looking for values (Materials*) but its not finding en exact match, its finding any cell with Materials or any part of the word in it and copy and pasting from there :/
Any ideas?
Thanks,
Dan
The code bellow is looking for values (Materials*) but its not finding en exact match, its finding any cell with Materials or any part of the word in it and copy and pasting from there :/
Any ideas?
Thanks,
Dan
Code:
Sub MaterialsInsertNewRow()
' Materials Controls
Dim b As Object, cs As Integer, LR As Integer
Dim rng As Range
Application.ScreenUpdating = False
Application.EnableEvents = False
Application.Calculation = xlCalculationManual
LR = Sheet1.Range("E:E").Find("Materials*", , xlValues, xlWhole, , xlNext).Row - 2
Set b = ActiveSheet.Buttons(Application.Caller)
With b.TopLeftCell
Sheet1.Unprotect Password:="rse1"
cs = .Row
Sheet1.Range("E:E").Find("Materials*", , xlValues, xlWhole, , xlNext).Offset(-1, 0).EntireRow.Copy
Rows(cs).Offset(.Rows.Count + 0).Insert
Rows(cs).Offset(.Rows.Count + 0).Hidden = False
Sheet1.Protect Password:="rse1"
End With
Application.ScreenUpdating = True
Application.EnableEvents = True
Application.Calculation = xlCalculationAutomatic
End Sub