It seems like this ought to be simple, but I can't figure out the correct syntax.
I have a worksheet (Sheet1) with a value of 1234 in cell F12. It is formatted as a number with 0 decimal places. I am trying to copy that value of 1234 into a variable. Here is my routine:
Sub SetVarFromCell()
Dim FTW As Long
Worksheets("Sheet1").Activate
FTW = Cells(12, "F").Value
End Sub
This routine runs without error, but FTW has a value of "0", rather than "1234" which is what it is supposed to have. I have also tried the statement:
FTW = Range("F12").Value and the result is the same -- "0" instead of "1234".
Is there a way to assign the value of the cell (1234) to the variable FTW?
Thanks,
Hector
I have a worksheet (Sheet1) with a value of 1234 in cell F12. It is formatted as a number with 0 decimal places. I am trying to copy that value of 1234 into a variable. Here is my routine:
Sub SetVarFromCell()
Dim FTW As Long
Worksheets("Sheet1").Activate
FTW = Cells(12, "F").Value
End Sub
This routine runs without error, but FTW has a value of "0", rather than "1234" which is what it is supposed to have. I have also tried the statement:
FTW = Range("F12").Value and the result is the same -- "0" instead of "1234".
Is there a way to assign the value of the cell (1234) to the variable FTW?
Thanks,
Hector