move a variable value in a macro to a cell

  • Thread starter Thread starter Mike
  • Start date Start date
M

Mike

Within a macro I am using several variables as counters. At the end of the
the session I need to move the values of the variables into the spread sheet
before saving. I used the value statement to bring the cel values in the
variables but can not go the other direction.
 
Here is some code to read and write a value from a sheet.
'*************************************
dim lng as long

lng = sheets("Sheet1").Range("A1").value
lng = lng + 1
sheets("Sheet1").unprotect 'assuming protection
sheets("Sheet1").Range("A1").value = lng
sheets("Sheet1").protect 'assuming protection
'*************************************
 
Back
Top