+ Reply to Thread
Results 1 to 3 of 3

next without for error please help

Hybrid View

Jenkins27 next without for error please... 01-29-2015, 03:35 PM
pjwhitfield Re: next without for error... 01-29-2015, 03:48 PM
Jenkins27 Re: next without for error... 01-29-2015, 03:50 PM
  1. #1
    Forum Contributor
    Join Date
    01-27-2015
    Location
    New hampshire
    MS-Off Ver
    excel 2013
    Posts
    143

    next without for error please help

      MyNum = ThisWorkbook.Sheets("Measurements").Range("H13").value
    On Error Resume Next
    For Each MyWb In Array("eqdcs 1.xlsm", "eqdcs 2.xlsm", "eqdcs 3.xlsm", "eqdcs 4.xlsm", "eqdcs 5.xlsm", "eqdcs 6.xlsm")
        Application.ScreenUpdating = False
        Set wbOPEN = Workbooks(MyWb)
        
        If Not wbOPEN Is Nothing Then
            WasOpen = True
        Else
            Set wbOPEN = Workbooks.Open(ThisWorkbook.Path & Application.PathSeparator & MyWb)
        End If
        ThisWorkbook.Sheets("Measurements").Unprotect Password:="password"
        wbOPEN.Sheets("measurements").Range("H13").value = MyNum
     ThisWorkbook.Sheets("Measurements").Unprotect Password:="password"
      
      ThisWorkbook.Sheets("Msg").Unprotect Password:="password"
    
      
        Set ws = Worksheets("MSG")
        lRow = ws.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
        With ws
        If Me.yesbox.value = True Then .Cells(lRow, 2).value = "yes"
          .Cells(lRow, 1).value = Me.Namebox.value
            
            
             .Cells(lRow, 3).value = Format(Now(), "mm/dd/yyyy")
            .Cells(lRow, 4).value = Format(Now(), "Hh:Nn:Ss AMPM")
      
    ThisWorkbook.Sheets("Msg").Protect Password:="password"
        
        If WasOpen Then
        
    
        wbOPEN.Save
    Else: wbOPEN.Close True
         Set wbOPEN = Nothing
        WasOpen = False
     
         End If
        
            Next MyWb
            ThisWorkbook.Save

  2. #2
    Forum Expert
    Join Date
    10-09-2014
    Location
    Newcastle, England
    MS-Off Ver
    2003 & 2013
    Posts
    1,986

    Re: next without for error please help

    try changing:

       If WasOpen Then
           wbOPEN.Save
    Else: wbOPEN.Close True
         Set wbOPEN = Nothing
        WasOpen = False
     
         End If
    to
       If WasOpen Then
         wbOPEN.Save
    Else
         wbOPEN.Close True
         Set wbOPEN = Nothing
         WasOpen = False
     End If
    If someone has helped you then please add to their Reputation

  3. #3
    Forum Contributor
    Join Date
    01-27-2015
    Location
    New hampshire
    MS-Off Ver
    excel 2013
    Posts
    143

    Re: next without for error please help

    I still got the same error..

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Run-tim error -2147467259(80004005): Automation error Unspecidied error
    By mattress58 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-25-2014, 12:12 PM
  2. Excel macro (compile error. syntax error.) error
    By salar_younis in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-06-2014, 06:11 AM
  3. Error "run-time Error '1004': General Odbc Error
    By D4WNO77 in forum Access Tables & Databases
    Replies: 2
    Last Post: 07-16-2012, 09:55 AM
  4. Error 75 File/Path access error, sometimes Error 1004
    By smokebreak in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 02-16-2011, 02:35 PM
  5. [SOLVED] Error Handling - On Error GoTo doesn't trap error successfully
    By David in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-16-2006, 02:10 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1