The following code in Outside Storage2 works fine:
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Range("C1").Select 'ASN cell
If Target.Column = 3 And Target.Row = 1 Then
Target.Offset(5, -2).Activate
End If
If Target.Column = 1 Then
Target.Offset(0, 1).Activate
End If
If Target.Column = 2 Then
Target.Offset(1, -1).Activate
End If
End Sub
I tried to add an input box and use the value entered in a counter, but the code does not work. This is the code in Outside Storage3:
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim strUsrIn As Integer 'also tried Dim strUsrln As String
Dim J As Integer
Range("E2").Select
'InputBox # 1 - Number of Pallets
strUsrIn = InputBox("Enter Number of Pallets")
If IsNull(strUsrIn) Then Exit Sub
Range("E2").Value = strUsrIn
Range("C1").Select 'ASN cell
If Target.Column = 3 And Target.Row = 1 Then
Target.Offset(5, -2).Activate
End If
J = 6
For J = 6 To strUsrIn + 6
If Target.Column = 1 Then
Target.Offset(0, 1).Activate
End If
If Target.Column = 2 Then
Target.Offset(1, -1).Activate
End If
Next
End Sub
I want the input box to open upon the opening of the spreadsheet, but it doesn't. If I enter a value in C1, then the input box opens. But then I can't get the input box to close. It results in an endless loop.
I have attached both spreadsheets. Any help will be greatly appreciated.
Bookmarks