vba - Macro in Excel: How to use contents of two adjacent cells (horizontal), autofill, and stop at certain word in spreadsheet -
vba - Macro in Excel: How to use contents of two adjacent cells (horizontal), autofill, and stop at certain word in spreadsheet -
i create macro in excel that:
1st: finds cell word.
2nd: goes downwards 1 cell , left 2 cells (arrow keys) (from column c column a)
3rd: selects cell in column a, , adjacent cell in column b
4th: auto fills columns , b respective contents until next instance of same word in step 1. (repeat process)....could done in loop?
thank in advance!!!
this ended working. got nice fellow on @ ozgrid:
sub findandfill() dim firstadd string, findword string dim fcell range dim firstrow long, nextrow long, lastrow long
findword = inputbox("what looking for?", "search word") if findword = "" exit sub application.screenupdating = false activesheet.range("c:c") set fcell = .find(findword) if fcell nil msgbox findword & " not found.", vbokonly, "not found" exit sub end if 'define our limits firstadd = fcell.address lastrow = activesheet.usedrange.rows.count firstrow = fcell.row set fcell = .findnext(fcell) if fcell.address = firstadd nextrow = lastrow else nextrow = fcell.row - 1 end if range(cells(firstrow + 1, "a"), cells(nextrow, "b")).filldown loop until nextrow = lastrow end application.screenupdating = true
end sub
vba excel-vba autofill
Comments
Post a Comment