Trying to run this code for a submit button on a form that is supposed to insert the values into the Excel sheet and each time it is clicked will move down a row and insert values again. Getting the "438" error though.
Sub AddPromotionButton_Click()
Dim LR As Long
LR = Worksheets("New Promotion").cell(Rows.Count, 1).End(xlUp).Row 1
Range("A" & LR).Value = NameofPromotion.Value
Range("B" & LR).Value = InvoiceText.Value
Range("C" & LR).Value = ChildOffer.Value
Range("D" & LR).Value = FlatorPercentage.Value
Range("E" & LR).Value = DiscountRate.Value
Range("F" & LR).Value = OperatingCenter.Value
Range("G" & LR).Value = FTA.Value
Range("H" & LR).Value = MarketArea.Value
Range("I" & LR).Value = DurationofPromo.Value
Range("J" & LR).Value = StartDate.Value
Range("K" & LR).Value = EndDate.Value
Range("L" & LR).Value = GL.Value
End Sub
CodePudding user response:
Change this ...
LR = Worksheets("New Promotion").cell(Rows.Count, 1).End(xlUp).Row 1
... to this ...
LR = Worksheets("New Promotion").Cells(Rows.Count, 1).End(xlUp).Row 1
