Derek McGill
Active Member
I am filling Col a and e with formula's with the following code, How do i change it to only fill up only one cell
Code:
Private Sub CommandButton1_Click()
Dim GradingCol As Integer
Dim LastRow As Long
If Len(TextBox2.Value) = 0 Then
MsgBox "The Name field can not be left empty!", vbOKOnly, "Derry Gradings System"
TextBox2.SetFocus
Exit Sub
End If
If TextBox4.Value = "" Then Call CommandButton2_Click
Sheets("Gradings").Select
GradingCol = 4
'Find the last used row in a Column: column A in this example
With ActiveSheet
LastRow = .Cells(.Rows.Count, "D").End(xlUp).row
LastRow = LastRow + 1
End With
'Activate Bottom Cell
Cells(LastRow, GradingCol).Activate
'Collect all Inputs and place in (Grading) Sheet
ActiveCell.Value = TextBox4.Value
ActiveCell.Offset(0, -1) = TextBox3.Value
ActiveCell.Offset(0, -2) = TextBox2.Value
' Add formulas to col A and E
LastRow = Range("B65536").End(xlUp).row 'Find the row number of the last cell used in column "B"
Range("A2").Resize(LastRow - 1).Formula = "=B2 &"" ""& C2"
LastRow = Range("D65536").End(xlUp).row 'Find the row number of the last cell used in column "D"
Range("E2").Resize(LastRow - 1).Formula = "=IF(D2<1200,40,IF(D2<1500,32,IF(D2<1800,24,IF(D2<2100,16,8))))"
Call SortLookupTable
Unload Me
End Sub