rmobley232

New Member
Joined
Jun 30, 2016
Messages
15
I am trying to write a do if loop command that takes a look at data in 3 different columns and then outputs a value to a 4th column (F in the command). When I run this command, Excel stops responding, I have even left my computer for a few hours and still not responding, please help with what is causing Excel to lock up with my code! Thanks so much for the assistance:

Sub SSUpdate()


' SSUpdate Macro


Dim Request As String
Dim SafetyStock As Double
Dim Location As String


Worksheets("SS Maint").Activate
Range("F2").Select


Do

Request = ActiveCell.Offset(0, -2).Value
SafetyStock = ActiveCell.Offset(0, -3).Value
Location = ActiveCell.Offset(0, -4).Value

If Request = "3rd Party to Stock" Then
ActiveCell.Value = "ST"
ElseIf SafetyStock > 0 Then
ActiveCell.Value = "SL"
ElseIf ((SafetyStock = 0) And (Location = "002" Or "003" Or "005")) Then
ActiveCell.Value = "PO"
Else: ActiveCell.Value = "NS"
End If

Loop Until IsEmpty(ActiveCell.Offset(0, -5))

End Sub
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand

steve the fish

Well-known Member
Joined
Oct 20, 2009
Messages
8,713
Office Version
  1. 365
Platform
  1. Windows
Its because that is an endless loop. You never move the activecell so the loop just keeps doing the same things over and over.
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,163,892
Messages
5,834,268
Members
430,273
Latest member
Windrunner

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
Top