Help!!! VBA working in Windows XP, but not Windows 7!!!

riley2323

New Member
Joined
May 7, 2013
Messages
1
Looking for some help with code that is not working on windows 7 machines at work but does work on all the Windows XP machines. It is difficult to test because I am still on the dinosaur XP and do not get the error. I have tried to troubleshoot via Webex, but that is painfully slow....looking for help. Here is the code.
Code:
Sub ChangeFormDataToPrevailTablet()
'Do the locations match?
Application.ScreenUpdating = False
Sheet1.Activate
Dim Answer As String
Dim MyNote As String
Dim YourResult As String
 If Left(Sheet1.Range("a11").Value, 5) <> Left(Sheet9.Range("h6"), 5) Then
    'Place your text here
    MyNote = "Your Prevail Location does not match the -Change Form- location. Do you want to continue? Click Yes to proceed or No to fix this issue."
    'Display MessageBox
    Answer = MsgBox(MyNote, vbQuestion + vbYesNo, "Question?")
    If Answer = vbNo Then
    Sheet1.Activate
    Sheet1.Range("b1").Select
    Exit Sub
        'Code for No button Press
      
    Else
    GoTo line1
        'Code for Yes button Press
    
        
    End If
    End If
line1:
Call Sheet9.ClearNonRed
Sheet1.Activate
Dim match1 As Variant
v = 11
Do Until Sheet1.Cells(v, 3) = ""
v = v + 1
Loop
h = 7
Do Until Sheet9.Cells(9, h) = "Notes:"
h = h + 1
Loop
    Dim LastRow As Integer
    Dim LastColumn As Integer
    Dim RunVariable As Integer
    LastRow = v
    LastColumn = h - 4
    
'Loop for the number of weeks in the change form.
q = 3
Do Until q = LastColumn
    'Loop for the number of skus in the Prevail Tablet.
    x = 11
    Do Until x = LastRow
    If WorksheetFunction.CountIf(Sheet9.Range("d:d"), Sheet1.Range("c" & x)) > 0 Then
    With Sheet9.Range("d:d")
    
    YourResult = .Find(What:=Sheet1.Range("c" & x), After:=.Cells(1, 1), _
           LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows, _
            SearchDirection:=xlNext, MatchCase:=False).Offset(0, q)
    If YourResult = "" Then GoTo line43
    
        
    End With
     Sheet1.Cells(x, q + 5).Select
     Selection.Value = vourresult
        With Selection.Interior
        .ColorIndex = 7
        .Pattern = xlSolid
    End With
    End If
    
line43:
    x = x + 1
    Loop
q = q + 1
Loop
Sheet1.Range("g11:x" & LastRow - 1).Select
Selection.Copy
Application.ScreenUpdating = True
End Sub
The users are getting an error message at the


YourResult = .Find(What:=Sheet1.Range("c" & x), After:=.Cells(1, 1), _
LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False).Offset(0, q)



line....they are getting an Error 91: Object Variable or With Block not set.
Can anyone offer any suggestions for working around this issue or as to why it would not work in Windows 7?
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
That's the result you'd get if the value were not found.
 
Upvote 0

Forum statistics

Threads
1,215,045
Messages
6,122,840
Members
449,096
Latest member
Erald

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top