My code is working fine in creating a new sheet, but the next part of the code is not working properly I have given certain fields which are to be entered in sheet 123 but it is entering only the value "Remarks" in cell A1 i.e only the last field . what is the problem?
I'm not able get it.
Sub CreateSheet()
Dim xName As String
Dim xSht As Object
On Error Resume Next
xName = InputBox("Please enter a name for this new sheet ")
If xName = "" Then Exit Sub
Set xSht = Sheets(xName)
If Not xSht Is Nothing Then
MsgBox "Sheet cannot be created as there is already a worksheet with the same name in this workbook"
Exit Sub
End If
Sheets.Add(, Sheets(Sheets.Count)).Name = xName
Sheets("New Ledger Creator").Activate
Dim lastrow As Long
lastrow = Range("b" & Rows.Count).End(xlUp).Row
Range("b" & lastrow + 1).Select
Selection = xName
Sheets("123").Select
Range("A1").Select
Selection.Value = "Paid"
Range("A2").Select
Selection.Value = "Date"
Range("B2").Select
Selection.Value = "For"
Range("C2").Select
Selection.Value = "Through"
Range("D2").Select
Selection.Value = "Amount"
Range("E2").Select
Selection.Value = "Remarks"
Range("F2").Select
Selection.Value = "Date"
Range("G2").Select
Selection.Value = "For"
Range("H2").Select
Selection.Value = "Through"
Range("I2").Select
Selection.Value = "Amount"
Range("J2").Select
Selection.Value = "Remarks"
Range("A1:E1").Select
End Sub