VBA stopping w/ no Error?

EdE

Board Regular
Joined
Apr 8, 2002
Messages
241
Does anyone know why a VBA would stop with out an error? It just runs and then stops in the middle of what it is doing? Here is the code:
If Range("c18").Value Then
Application.ScreenUpdating = False
Workbooks.Open FileName:= _
"\serverfolderMaterialsJimFJim.xls", _
UpdateLinks:=3, WriteResPassword:="jim"
'check to see if read only
If ActiveWorkbook.ReadOnly Then
ActiveWorkbook.Saved = True
ActiveWorkbook.Close
Range("e18").Select
Application.ScreenUpdating = True
ActiveCell.FormulaR1C1 = "Not Updated"
GoTo lastlinejim:
End If
'update file
Range("a1").Select
ActiveWorkbook.Save
ActiveWindow.Close
Range("i18").Select
ActiveCell.FormulaR1C1 = "Updated"
Application.ScreenUpdating = True
lastlinejim:
Range("a1").Select

End If
'displayed if not selected
If Range("c18") <> "True" Then
Range("e18").Select
ActiveCell.FormulaR1C1 = "Not Selected"
 
Ok, I am confused, what do you want to happen when this is FALSE:

<pre>
Range("c18").Value</pre>

..because you're not opening the other workbook.

You need to tell me exactly what you want this piece of code to do because it's not clear to me from the code.
 
Upvote 0

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Ok Here goes. If c18 is checked, then it tries to open the file. If not checked, it skips the whole procedure and proceeds to the next file that is. There are 21 of these. At this point, it determines if it is either read only or not. If read only, it returns not updated and then moves on to the next selected file. If not read only, opens the file, updates links, saves and then closes. At the end is a procedure for which sheets were updated or not, and sends out emails to the corresponding individuals. Hope this helps.
I also had this problem with another VBA where I had a statement that refreshed a pivot table, which is where it just quit. I deleted the lines, copied from another part of the program, then it ran just fine. That is why I was thinking it was flukey. Sorry about the book length.
Thanks!
 
Upvote 0

Forum statistics

Threads
1,213,546
Messages
6,114,256
Members
448,557
Latest member
richa mishra

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