vba - Data input on excel: form sheet to database sheet -
i'm using dynamic button on 1 sheet send data database/summary sheet within same workbook in excel.
i know know. should've done using access , queries, used trusty brute-force method in code shown below.
it works, it's painstakingly slow. please advise on how perform task less demand on processor.
'enter database nextspgp.value = range("b7").value nextdate.value = format(range("m7").value, "mm/dd/yyyy") nextstart.value = format(range("a12").value, "hh:mm") nextfinish.value = format(range("b12").value, "hh:mm") nextmix = range("c12").text nextbatch.value = range("d12").value nextgrouter.value = range("j7").value nextpump.value = range("h7").value nextpass.value = range("f7").value nextdepth.value = range("e12").value nextsleeve.value = range("f12").value nextinitpress.value = range("g12").value nextfinalpress.value = range("h12").value nextflow.value = range("i12").value nextvol.value = range("j12").value nextmove.value = range("k12").value nextcomment.value = range("l12").value
i start of routines this:
dim bscreenupdating boolean 'screen updating flag dim benableevents boolean dim lcalculation long application bscreenupdating = .screenupdating benableevents = .enableevents lcalculation = .calculation .screenupdating = false .enableevents = false .calculation = xlcalculationmanual end
...and end them this:
with application .screenupdating = bscreenupdating .enableevents = benableevents .calculation = lcalculation end
...so turn things off might slow progress, , restore users environment afterwards.
also, unless have reason use .value, use .value2. see excel mvp , recalculation guru charles williams' respone following thread: what difference between .text, .value, , .value2?
note defining ranges in vba code doing recipe disaster. inserts/deletes row/column, vba references pointing @ wrong cells. always give each of ranges of interest named range, , reference name in vba.
also, haven't given information workbook setup. how many values talking here? hundreds? thousands? , referencing destination cells in destination sheet? else can tell workbook? i.e. big file lots of formulas? kinds of formulas? vlookups? offset or other volatile functions? writing these values excel table aka listobject? these can slow things down - particularly if don't temporarily turn off calculation.
see following post wrote time more on formula volatility: http://chandoo.org/wp/2014/03/03/handle-volatile-functions-like-they-are-dynamite/
Comments
Post a Comment