excel vba - VBA to copy cell from Sheet"A" to merged cells in Sheet"B" -
how copy single cell raw worksheet"a" merged cells raw in worksheet"b" , suppose go next line in merged cells? have following vba work row 5 not other rows.
private sub decisionbtn_click() if sheets("baseline_ra").cells(activecell.row, 14).value = "health risk assessment" sheets("health ra").range("a5").value = sheets("baseline_ra").cells(activecell.row, 1) sheets("health ra").range("b5").value = sheets("baseline_ra").cells(activecell.row, 2) sheets("health ra").range("i5").value = sheets("baseline_ra").cells(activecell.row, 8) sheets("health ra").range("o5").value = sheets("baseline_ra").cells(activecell.row, 11) sheets("health ra").range("p5").value = sheets("baseline_ra").cells(activecell.row, 12) sheets("health ra").range("q5").value = sheets("baseline_ra").cells(activecell.row, 13) elseif sheets("baseline_ra").cells(activecell.row, 14).value = "task risk assessment" sheets("task ra").range("a5").value = sheets("baseline_ra").cells(activecell.row, 1) sheets("task ra").range("b5").value = sheets("baseline_ra").cells(activecell.row, 2) sheets("task ra").range("j5").value = sheets("baseline_ra").cells(activecell.row, 8) sheets("task ra").range("p5").value = sheets("baseline_ra").cells(activecell.row, 11) sheets("task ra").range("q5").value = sheets("baseline_ra").cells(activecell.row, 12) sheets("task ra").range("r5").value = sheets("baseline_ra").cells(activecell.row, 13) elseif sheets("baseline_ra").cells(activecell.row, 14).value = "environment risk assessment" sheets("environment ra").range("a5").value = sheets("baseline_ra").cells(activecell.row, 1) sheets("environment ra").range("b5").value = sheets("baseline_ra").cells(activecell.row, 2) sheets("environment ra").range("h5").value = sheets("baseline_ra").cells(activecell.row, 8) sheets("environment ra").range("n5").value = sheets("baseline_ra").cells(activecell.row, 11) sheets("environment ra").range("o5").value = sheets("baseline_ra").cells(activecell.row, 12) sheets("environment ra").range("p5").value = sheets("baseline_ra").cells(activecell.row, 13) elseif sheets("baseline_ra").cells(activecell.row, 14).value = "non-process risk assessment" sheets("non-process ra").range("a5").value = sheets("baseline_ra").cells(activecell.row, 1) sheets("non-process ra").range("b5").value = sheets("baseline_ra").cells(activecell.row, 2) sheets("non-process ra").range("h5").value = sheets("baseline_ra").cells(activecell.row, 8) sheets("non-process ra").range("n5").value = sheets("baseline_ra").cells(activecell.row, 11) sheets("non-process ra").range("o5").value = sheets("baseline_ra").cells(activecell.row, 12) sheets("non-process ra").range("p5").value = sheets("baseline_ra").cells(activecell.row, 13) end if end sub
to paste in merged area should this: assuming mergearea a1:a6
range("a1:a6").mergearea.cells(1, 1).value = 'the value want paste.
Comments
Post a Comment