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
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