Visual Basic  - First example in Excel

Computer Applications in Finance

                       

Question: How can I add a constant to a cell reference through Visual Basic code.

Press Alt + F11

Insert > Modeul and copy paste the following

Sub AddOne()

Cells(1,1).value = Cells(1,1).value + 1

End Sub

Details:

Start a macro

Sub PDFmaker ()

End sub

 

What is the cell reference of A1

Cells(1,1)

 

How to get value of cell A1

Cells(1,1).value

 

How to add one to the value of cell A1

Cells(1,1).value = Cells(1,1).value + 1

How write a macro for this

Sub AddOne()

Cells(1,1).value = Cells(1,1).value + 1

End Sub