Input box
>
To return range: Assing type as 8 in input box
use SET key word(use SET key word to assign value to Objects)
Private Sub CommandButton1_Click()
'1)Define a variable to store data which is mentioned in INPUTBOX
Dim i As String
i = Application.InputBox("Sriguranjani", "Welcome")
'2)Define a range where we require to paste the data which is stored in variable
Range("A1:A11").Value = "hello " & i & " Good Morning"
'3)Store the data from First data cell to last data cell in a variable
Dim s As Integer
s = Range(Range("A1"), Range("A1").End(xlDown)).Rows.Count
Range(Cells(1, 1), Cells(s, 1)).Select
With Selection
'4)Specify the font size
.Font.Size = 15
'5)Specify the Horizontal alignment
.HorizontalAlignment = xlCenterAcrossSelection
auto adjust the cell width based on text available., all the data need to fit in a cell only
.Cells.EntireColumn.AutoFit
'6)Assign a font family
.Font.Name = "High Tower Text"
'7)Assign a font Color
.Font.ColorIndex = 3
End With
End Sub
Private Sub CommandButton2_Click()
Dim s As Integer
1)Select all the data using end xl down method
Q = Range(Range("A1"), Range("A1").End(xlDown)).Rows.Count
Range(Cells(1, 1), Cells(Q, 1)).Select
2)To clear\erase all the text available in excel sheet which is mentioned in range
Selection.Clear
3)resize the column width
Columns("A").ColumnWidth = StandardWidth
End Sub