move a variable value in a macro to a cell

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.
 
J

Jim Thomlinson

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
'*************************************
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top