Hi all,
can some one suggest the idea to clear this code for the range of activecell that was selected and lastrow.
Code
- Private Sub CommandButton2_Click()
- Dim irow As Long
- Dim activeworksheet As Worksheet
- Dim lastrow As Long
- irow = activeworkbook.Worksheets("sheet2").Cells(Rows.Count, 1).End(xlUp).Row + 1
- lastrow = Cells(Cells.Rows.Count, "B").End(xlUp).Row
- Set activeworksheet = ThisWorkbook.Worksheets("sheet2")
- With activeworksheet
- .Cells(irow, 1) = UserForm1.TextBox1.value
- .Cells(irow, 1).Select
- Selection.AutoFill Destination:=range(activecell & lastrow)
- End With
- End Sub