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

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Its because that is an endless loop. You never move the activecell so the loop just keeps doing the same things over and over.
 
Upvote 0

Forum statistics

Threads
1,214,952
Messages
6,122,458
Members
449,085
Latest member
ExcelError

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