excel - Transferring array to another Worksheet -
in 1 worksheet called 'flange management sheet' have quite large data base of information , in sheet called 'cert sheet' have form i've created fields need filled fms.
i select first cell in row of information , click button , cert sheet populated.
i think way go using array.
i've created this
array(“a = q14”, “b = c12”, “d = q12”, “k = c11”, “l=c14”, “m=c16”, “n=c17”, “o = c19”, “p = q19”, “q=c18”, “t=c27”, “u=q27”, “x = c24”, “y = c25”, “z=q24”, “aa=q25”, “ab=q26”, “ad = l5", “ae = n30”)
its , how implement in vba.
this has come because have enter information manually in word document , there must simple way of auto populating.
edit clarity - i'm looking using information on flange management matrix used populate form created on separate worksheet.
in fmm sheet have - ao of fields 400 rows of relevant information under fields.
example in column - 'tag id, column b - 'line no', column k - 'drawing number' etc... followed 400 rows unique tag id's, , on along columns.
i have created form in worksheet called 'cert sheet' printable version of relevant client information in information collected on fmm client.
what (for example) click on cell a10 or cell in column (the tag id field), click 'make cert' , use fields fmm relevent , populate cert sheet.
again example using 'tag id' field. cell a10 need placed in cell q14 on cert sheet.
i've done above array column on fmm = relevent cell on cert sheet.
you may find easier - instead of using array - create "config" sheet in workbook , read mapping there.
say (e.g.) put mapping data in a2:b10, cola has source column letter , colb has destination cell on form want fill.
sub transfer() dim shtsrc worksheet, shtdest worksheet, rngconfig range dim rwsrc range, rwmap range set shtsrc = thisworkbook.sheets("flange management sheet") set shtdest = thisworkbook.sheets("cert sheet") set rngconfig = thisworkbook.sheets("config").range("a2:b10") 'exit if range not selected... if typename(selection) <> "range" exit sub '...or if it's on wrong sheet if selection.parent.name <> shtsrc.name exit sub 'what row selected? set rwsrc = selection.cells(1).entirerow 'loop through each row in config table each rwmap in rngconfig.rows 'make sure row has mapping if len(rwmap.cells(1).value) > 0 , _ len(rwmap.cells(2).value) > 0 'transfer value shtdest.range(rwmap.cells(2).value) = _ rwsrc.cells(1, rwmap.cells(1).value).value end if next rwmap end sub
Comments
Post a Comment