excel - VBA copy lines between workbooks -
i'm looking ideas how to-do side task in exel. situation: have 2 workbooks- , b. need copy specific data b. data static - case ok, used code copying -
sub button399_click() dim sutartis string dim projektoid string dim projektas string dim aktas workbook worksheets("aktas").select sutartis = range("k4") projektoid = range("k5") projektas = range("e12") set mydata = workbooks.open("*****") worksheets("archyve").select worksheets("archyve").range("a1").select rowcount = worksheets("archyve").range("a1").currentregion.rows.count worksheets("archyve").range("a1") .offset(rowcount, 0) = sutartis .offset(rowcount, 1) = projektoid .offset(rowcount, 2) = projektas end mydata.save end sub
second, need copy data each line , add b workbook static in every line. check list
in result, should this: result
waiting suggestions , ideas!
best regards
the following function retrieves data closed workbook. credit http://erlandsendata.no/?p=2106
private function getinfofromclosedfile(byval wbpath string, wbname string, wsname string, cellref string) variant dim arg string getinfofromclosedfile = vbnullstring if right(wbpath, 1) <> "\" wbpath = wbpath & "\" if dir(wbpath & wbname) = vbnullstring exit function arg = "'" & wbpath & "[" & wbname & "]" & wsname & "'!" & range(cellref).address(true, true, xlr1c1) 'on error resume next getinfofromclosedfile = executeexcel4macro(arg) end function
Comments
Post a Comment