rmobley232

New Member
Joined
Jun 30, 2016
Messages
13
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
 

Some videos you may like

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.

steve the fish

Well-known Member
Joined
Oct 20, 2009
Messages
8,216
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.
 

Watch MrExcel Video

Forum statistics

Threads
1,122,230
Messages
5,594,949
Members
413,953
Latest member
Arthur1471

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