well, now i'm really confused (doesn't take much LOL).
i have created the following to clear the contents of any unlocked cells on a number of worksheets.
The code is in a module and runs fine if i run it form there, however i have created a command button on a form to run this. when run from the form it doesn't work - appears to run OK with no errors, but does not clear the cells.
Anyone spot where i am going worng with this?
Cheers, Craig
Si fractum non sit, noli id reficere
i have created the following to clear the contents of any unlocked cells on a number of worksheets.
Code:
Function clearUserInput()
'Clears any data that has been input by the user
'Application.ScreenUpdating = False
Dim shName
Dim c
Dim wb As Workbook
Set wb = ThisWorkbook
With wb
For Each shName In Array("sheet1", "sheet2", "sheet3", "sheet4")
For Each c In Range("A1:Gy250")
If c.Locked = False Then c.ClearContents
Next
Next
End With
'Application.ScreenUpdating = True
End Function
Anyone spot where i am going worng with this?
Cheers, Craig
Si fractum non sit, noli id reficere