I am working on an workbook that serves as a character sheet in a table top RPG that I play. I am trying to find a way to code the hit point functions in VBA so that I can enter numbers in three different cells and have the entered numbers subtract or add to other cells and then clear the field for another entry. One for taking damage, one for getting healed, and one for gaining temp HP. I realize some of this may be information you don't need to know but I feel like explaining what I want to accomplish is helpful. the code I have come up with so far is this:
Sub HitPointFunction()
If Worksheets("Main").Range("M29").Value = 0 Then
Worksheets("Main").Range("M29").Value -Range("I28").Value
Else
Worksheets("Main").Range("M29").Value -Range("I28").Value
End If
End Sub
I am just getting started on the attempt at coding this and quickly ran into problems. This doesn't work. It throws up run-time error 438: Object doesn't support this property or method. I realize this is basic code but I am not experienced in this at all. I am simply trying to learn through Google. I don't think this works conceptually or at least not the way I am writing it. I can attach the workbook if that would help just let me know
Sub HitPointFunction()
If Worksheets("Main").Range("M29").Value = 0 Then
Worksheets("Main").Range("M29").Value -Range("I28").Value
Else
Worksheets("Main").Range("M29").Value -Range("I28").Value
End If
End Sub
I am just getting started on the attempt at coding this and quickly ran into problems. This doesn't work. It throws up run-time error 438: Object doesn't support this property or method. I realize this is basic code but I am not experienced in this at all. I am simply trying to learn through Google. I don't think this works conceptually or at least not the way I am writing it. I can attach the workbook if that would help just let me know