Hi
I am new here and fairly new to excel vba. When I run the code below to populate a given row input select, excel freezes . It works OK with when input say 3.
Sub Record_Num()
Dim MyNum As Integer
Dim Record As Integer
Dim IP As Integer
Dim Logo As Integer
Dim EAN As Integer
Dim Phase As Integer
Dim FilClass As Integer
Dim StoreTemp As Integer
Worksheets("Sheet1").Activate
Application.ScreenUpdating = True
MyNum = Application.InputBox("Enter Number of Records")
For Record = 1 To MyNum
For Logo = 1 To MyNum
For IP = 1 To MyNum
For EAN = 1 To MyNum
For Phase = 1 To MyNum
For FilClass = 1 To MyNum
For StoreTemp = 1 To MyNum
Cells(30, StoreTemp + 2).Value = "-40 - + 70" & Chr(186) & "C"
With Cells(28, FilClass + 2).Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="Unfiltered,Line Class Filter A,Line Class Filter B"
.ShowInput = True
.ShowError = True
End With
With Cells(14, Phase + 2).Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="3Ø AC,1Ø AC"
.ShowInput = True
.ShowError = True
End With
With Cells(11, EAN + 2).Validation
.Delete
.Add Type:=xlValidateTextLength, AlertStyle:=xlValidAlertStop, Operator:=xlEqual, Formula1:="12"
.ErrorMessage = "Must be first 12 digits of 13 digit EAN Number"
.ShowInput = True
.ShowError = True
End With
Cells(1, Record + 2).Value = "Record" & " " & Record
With Cells(2, Logo + 2).Font
.Name = "Siemens Logo"
.Size = 11
End With
With Cells(27, IP + 2).Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:=" , , IP20,IP54,IP55,IP65"
.ShowInput = True
.ShowError = True
End With
Next StoreTemp
Next FilClass
Next Phase
Next EAN
Next IP
Next Logo
Next Record
End Sub
T
I am new here and fairly new to excel vba. When I run the code below to populate a given row input select, excel freezes . It works OK with when input say 3.
Sub Record_Num()
Dim MyNum As Integer
Dim Record As Integer
Dim IP As Integer
Dim Logo As Integer
Dim EAN As Integer
Dim Phase As Integer
Dim FilClass As Integer
Dim StoreTemp As Integer
Worksheets("Sheet1").Activate
Application.ScreenUpdating = True
MyNum = Application.InputBox("Enter Number of Records")
For Record = 1 To MyNum
For Logo = 1 To MyNum
For IP = 1 To MyNum
For EAN = 1 To MyNum
For Phase = 1 To MyNum
For FilClass = 1 To MyNum
For StoreTemp = 1 To MyNum
Cells(30, StoreTemp + 2).Value = "-40 - + 70" & Chr(186) & "C"
With Cells(28, FilClass + 2).Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="Unfiltered,Line Class Filter A,Line Class Filter B"
.ShowInput = True
.ShowError = True
End With
With Cells(14, Phase + 2).Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="3Ø AC,1Ø AC"
.ShowInput = True
.ShowError = True
End With
With Cells(11, EAN + 2).Validation
.Delete
.Add Type:=xlValidateTextLength, AlertStyle:=xlValidAlertStop, Operator:=xlEqual, Formula1:="12"
.ErrorMessage = "Must be first 12 digits of 13 digit EAN Number"
.ShowInput = True
.ShowError = True
End With
Cells(1, Record + 2).Value = "Record" & " " & Record
With Cells(2, Logo + 2).Font
.Name = "Siemens Logo"
.Size = 11
End With
With Cells(27, IP + 2).Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:=" , , IP20,IP54,IP55,IP65"
.ShowInput = True
.ShowError = True
End With
Next StoreTemp
Next FilClass
Next Phase
Next EAN
Next IP
Next Logo
Next Record
End Sub
T