How to access worksheet in excel using VBA

By declaring variable as Worksheet, we can access worksheet and cell in excel.
Dim sht1 As Worksheet
Set sht1 = Worksheets(1)
sht1.Cells(1,1) = "Hello World"

No comments: