G
Guest
Hi
I have the ffg cade to enter data to a sheet. It works fine but how can i
improve it as to shorten it.......
Sub ActualAdd()
ActiveCell.FormulaR1C1 = frmMain.txt2.Text
ActiveCell.Offset(0, 1).Select
ActiveCell.FormulaR1C1 = frmMain.txt3.Text
ActiveCell.Offset(0, 1).Select
ActiveCell.FormulaR1C1 = frmMain.txt4.Text
ActiveCell.Offset(0, 1).Select
ActiveCell.FormulaR1C1 = frmMain.txt5.Text
ActiveCell.Offset(0, 1).Select
ActiveCell.FormulaR1C1 = frmMain.txt6.Text
ActiveCell.Offset(0, 1).Select
ActiveCell.FormulaR1C1 = frmMain.txt7.Text
ActiveCell.Offset(0, 1).Select
ActiveCell.FormulaR1C1 = frmMain.txt8.Text
ActiveCell.Offset(0, 1).Select
ActiveCell.FormulaR1C1 = frmMain.txt9.Text
ActiveCell.Offset(0, 1).Select
ActiveCell.FormulaR1C1 = frmMain.txt10.Text
ActiveCell.Offset(0, 1).Select
ActiveCell.FormulaR1C1 = frmMain.txt11.Text
ActiveCell.Offset(0, 1).Select
ActiveCell.FormulaR1C1 = frmMain.txt12.Text
ActiveCell.Offset(0, 1).Select
ActiveCell.FormulaR1C1 = frmMain.txt13.Text
ActiveCell.Offset(0, 1).Select
ActiveCell.FormulaR1C1 = frmMain.txt14.Text
ActiveCell.Offset(0, 1).Select
ActiveCell.FormulaR1C1 = frmMain.txt15.Text
Range("A3").Select
Selection.CurrentRegion.Select
Selection.Name = "CustomerInfo"
Selection.HorizontalAlignment = xlLeft
Selection.Sort Key1:=Range("A3"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End Sub
Thanx
I have the ffg cade to enter data to a sheet. It works fine but how can i
improve it as to shorten it.......
Sub ActualAdd()
ActiveCell.FormulaR1C1 = frmMain.txt2.Text
ActiveCell.Offset(0, 1).Select
ActiveCell.FormulaR1C1 = frmMain.txt3.Text
ActiveCell.Offset(0, 1).Select
ActiveCell.FormulaR1C1 = frmMain.txt4.Text
ActiveCell.Offset(0, 1).Select
ActiveCell.FormulaR1C1 = frmMain.txt5.Text
ActiveCell.Offset(0, 1).Select
ActiveCell.FormulaR1C1 = frmMain.txt6.Text
ActiveCell.Offset(0, 1).Select
ActiveCell.FormulaR1C1 = frmMain.txt7.Text
ActiveCell.Offset(0, 1).Select
ActiveCell.FormulaR1C1 = frmMain.txt8.Text
ActiveCell.Offset(0, 1).Select
ActiveCell.FormulaR1C1 = frmMain.txt9.Text
ActiveCell.Offset(0, 1).Select
ActiveCell.FormulaR1C1 = frmMain.txt10.Text
ActiveCell.Offset(0, 1).Select
ActiveCell.FormulaR1C1 = frmMain.txt11.Text
ActiveCell.Offset(0, 1).Select
ActiveCell.FormulaR1C1 = frmMain.txt12.Text
ActiveCell.Offset(0, 1).Select
ActiveCell.FormulaR1C1 = frmMain.txt13.Text
ActiveCell.Offset(0, 1).Select
ActiveCell.FormulaR1C1 = frmMain.txt14.Text
ActiveCell.Offset(0, 1).Select
ActiveCell.FormulaR1C1 = frmMain.txt15.Text
Range("A3").Select
Selection.CurrentRegion.Select
Selection.Name = "CustomerInfo"
Selection.HorizontalAlignment = xlLeft
Selection.Sort Key1:=Range("A3"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End Sub
Thanx