I have a form that was built in a Windows 7 machine with some buttons and little VB functions. I put in a button and when I click the button, it works fine. It performs how it should. The button code is in the module. There is some other code in thisworkbook and other code that pertains to the actual form. I tested and all is fine. I had 2 others on my team on Windows 7 test and it is fine. I had the end-users test, which half are Windows XP and half are Windows 7. The end-users on Windows XP had no issues but the Windows 7 users when they click the button the macro will pop-up on their screen and highlight the first part of the code. The remaining end-users were just mirgrated to Windows 7 and now they get the error. I noticed not one has Developer on their main menu and they will not have that. As I said this code is in a module. I have placed it below and tried putting it in thisworkbook and on the form and it states it cannot find the button code when I move it out of module.
Sub Button3_Click()
Dim Start As Boolean
Dim rng1 As Range
Dim Prompt As String, rngstr As String
Dim cell As Range
'Protect the worksheet
ActiveSheet.Unprotect
Set rng1 = Sheets("Form").Range("B4, B7, B9, B12, B74, D8, A16, B10, D10, E74, E77")
'message is returned if there are blanks or no value in required fields
Prompt = "Please make sure are highlighted fields are filled in." & vbCrLf & _
"The following cells are incomplete and have been highlighted yellow:" _
& vbCrLf & vbCrLf
Start = True
'highlights the blank cells
For Each cell In rng1
If cell.Value = vbNullString Or cell.Value = 0 Or cell.Value <= 0 Then
cell.Interior.ColorIndex = 6 ' color yellow
If Start Then rngstr = rngstr & cell.Parent.Name & vbCrLf
Start = False
rngstr = rngstr & cell.Address(False, False) & ", "
Else
cell.Interior.ColorIndex = 0 '** no color
End If
Next
If rngstr <> "" Then rngstr = Left$(rngstr, Len(rngstr) - 2)
If rngstr <> "" Then
MsgBox Prompt & rngstr, vbCritical, "Incomplete Data"
End If
Set rng1 = Nothing
'Re-protect the worksheet
ActiveSheet.Protect
End Sub
Bookmarks