excel - Find a date in a column and paste data array in neighbouring cells -
hy guys, have following issue: have 2 files- , b in file have precise date in cell a1 in range c3:z3 have values want copy , paste in file b
file b has list of dates in column a.
the issue: procedure has match date file a, cell a1 1 of dates in file b , paste values file a, cells c3:z3 in neighboring cells
so far came this, error "with" , don't know how fix it
sub copy_geofac() 'get date windows("file_a.xlsm").activate dim data date data = worksheets("sheet1").cells(1, "a").value range("c3:z3").select application.cutcopymode = false selection.copy windows("file_b.xlsx").activate dim findstring date dim rng range findstring = clng(data) sheets("geof").range("a:a") worksheets("geof").activate set rng = range("a:a").find(data) rng.offset(0, 1).select selection.paste.value end end sub
thanks in advance
your code works me 1 change. replace:
selection.paste.value
with:
selection.pastespecial paste:=xlpastevalues
there no value method of selection.paste. not valid syntax. replacement code working copy , paste values. still need modify code accomodate when date can't found in output spreadsheet that's simple if statement.
Comments
Post a Comment