Ranges Codes


1.       Sub ExampleWithRange()
Dim example As Range
Set example = Range("A1:C4")
example.Value = 8
End Sub

2.       Sub ExampleWithRange1()
Range("B3").Value = 2
End Sub

3.       Sub ExampleWithRange2()
Range("A1:A4").Value = 5
End Sub

4.       Sub ExampleWithCell()
Cells(3, 2).Value = 2
End Sub

5.       Sub ExampleWithCell1()
Range(Cells(1, 1), Cells(4, 1)).Value = 5
End Sub

6.       Sub ExampleWithCell2()
Cells(3, 2).Value = 2
End Sub

7.       Sub SelctingRangeWithVariable()
Dim example As Range
Set example = Range("A1:C4")
example.Select
End Sub

8.       Sub CopyAndPaste()
Range("A1:A2").Select
Selection.Copy
Range("C3").Select
ActiveSheet.Paste
End Sub

9.       Sub ContRow()
Dim example As Range
Set example = Range("A1:C4")
example.Select
MsgBox example.Rows.Count
End Sub



Post a Comment

0 Comments