excel - Storing user inputs for retrieving later -


i have spreadsheet user inputs various details on inputs page , presses calculate button want. inputs strings, numbers , dates.

i want save inputs each calculation user @ later date enter calc id , not have renter inputs.

one simple way thought of doing copy inputs when calculation run sheet inputs in column calc id. save future inputs in separate column , lookup correct column retrieve inputs @ later date.

i read question - what benefits of using classes in vba? , thought make class called calculationinputs had details stored in 1 object. may overkill need wanted ask how other people solve simple task.

you can use names define variables within scope of workbook or worksheet. typically these used define ranges, , more dynamic ranges, can used store static/constant values.

to create name manually, formula ribbon, names manager:

enter image description here

click on "new" button, , give meaningful name:

enter image description here

make sure put ="" in "refers to" field, if leave blank, name not created.

then when press ok, or time go names manager, see list of available names in workbook.

enter image description here

you can edit these through names manager, tedious, or can use vba , inputs control them, example:

sub test()     activeworkbook.names("myaddress").refersto = "734 evergreen terrace" end sub 

you capture value, our use other macros or user firm code assign value name.

activeworkbook.names("myaddress").refersto = _     application.inputbox("please enter address") 

etc.

if run this, , review names manager, you'll see value has been updated:

enter image description here

in vbe, can refer name like:

debug.print activeworkbook.names("myaddress").value '# prints in immediate pane range("a1") = activeworkbook.names("myaddress").value   

these can accessed (read) worksheet, like:

enter image description here


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -