Hi, First time posting on Mr. Excel. Has been an awesome reference. I am running into an issue. I am a novice with VBA, so bear with me. I am trying to populate a cell in a template with the value from a list of numbers. The number of templates varies, as does the number of values in the list. Here is the code: I am getting an error in on the line highlighted in red. I am running this macro from the Parent Code Sheet.
Any help is much appreciated!
Sub skus()
Dim lastrow As Long
Dim lastsku As Long
Application.DisplayStatusBar = True
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Application.Calculation = xlManual
lastrow = Sheets("Parent Code").Range("D1048576").End(xlUp).Row
lastsku = Sheets("SKU List").Range("A1048576").End(x1down).Row
For isku = 1 To lastrow
If Range("D" & lastrow).Value = "Demand" Then
Sheets("Parent Code").Range("D" & lastrow - 2).Value = Sheets("SKU List").Range("BR" & lastsku).Value
End If
lastsku = lastsku + 1
lastrow = lastrow - 1
Next isku
Application.ScreenUpdating = True
Application.DisplayAlerts = True
Application.Calculation = xlAutomatic
Application.StatusBar = False
End Sub
Any help is much appreciated!
Sub skus()
Dim lastrow As Long
Dim lastsku As Long
Application.DisplayStatusBar = True
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Application.Calculation = xlManual
lastrow = Sheets("Parent Code").Range("D1048576").End(xlUp).Row
lastsku = Sheets("SKU List").Range("A1048576").End(x1down).Row
For isku = 1 To lastrow
If Range("D" & lastrow).Value = "Demand" Then
Sheets("Parent Code").Range("D" & lastrow - 2).Value = Sheets("SKU List").Range("BR" & lastsku).Value
End If
lastsku = lastsku + 1
lastrow = lastrow - 1
Next isku
Application.ScreenUpdating = True
Application.DisplayAlerts = True
Application.Calculation = xlAutomatic
Application.StatusBar = False
End Sub