Private Sub CommandButton1_Click()
Dim a As String, bInvalid As Boolean, CurrDate As Date
CurrDate = Date
a = InputBox("Enter the Row", "Please enter the row number", "Please enter data")
If IsNumeric(a) Then
If a > 0 Then
Rows(a).Select
Selection.Copy
Selection.Insert Shift:=xlDown
Cells.EntireColumn.AutoFit
Range("L" & a).ClearContents
Rows(a + 1).Select
Range("S" & a).Value = CurrDate + 1
Selection.Rows.Group
ActiveSheet.Outline.ShowLevels RowLevels:=1
Else
bInvalid = True
End If
Else
' If the user presses Cancel, then a=""
If a <> "" Then bInvalid = True
End If
If bInvalid Then MsgBox "Please enter a valid row number"
End Sub
введите описание изображения здесь
В настоящее время я принимаю ввод строк от пользователя, но, как вы можете видеть на изображении, я хочу использовать sr.no как ввод от пользователя, например c1, c2, так что есть ли как приведенный выше код можно изменить и работать с вводом sr.no, а не со строкой?