Generally speaking selecting a value from a worksheet does nothing.
What we want to do is to see what is the value in a specific cell.
For my example, I am still in Sheet1 and would like to know what it the value in the cell A4 and also cell D4.
It would look something like this:
Sub CheckValues()
Dim strCellValue1 As String
Dim strCellValue2 As String
strCellValue1 = Sheets("Sheet1").Range("A4").Value
strCellValue1 = Sheets("Sheet1").Range("D4").Value
End Sub
I have defined two variables so that I can input the values in cells A4 and D4 in them.
For today’s homework:
Complete the above code with the following conditions.
Input a whole number in cell A4 of Sheet1.
Input a different whole number in cell D4 of Sheet1.
Write an If Statement that verifies is the value in A4 is larger than the value in D4.
If it is, have a message box that states that A4 is larger.
if it is not, have a message box that states that D4 is larger