Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
button awareness. i dont know if it can be done.
well....its a spreadsheet that has my products on it....and we offer different colors for each product.....so instead of have a thousand lines of products to choose from....we just have one that you can specify color.....the button next to the row adds a second line of the same product on the next row down...so they can have 2 or more colors on the same item...... so i just want the button to duplicate the row on the next row down. and im trying to get it so i dont have to have 250+ macro's with only a model number in the code differing them.....i just want one macro that can tell what button activated it and duplicate just that one item. hope that helps.... heres my code so far.....but its the code for only one product of 250+ sub add_line_item() application.screenupdating = false dim foundcell as range with activesheet.range(\"a:a\") set foundcell = .find(what:=\"ga1078\", _ after:=.cells(.cells.count), _ lookin:=xlformulas, lookat:=xlpart, _ searchorder:=xlbyrows, searchdirection:=xlnext, _ matchcase:=false) end with if foundcell is nothing then msgbox \"can not add more.\" else foundcell.select end if activecell.offset(1, -activecell.column + 1).select activecell.entirerow.select selection.insert shift:=xldown foundcell.select selection.resize(1, 12).select selection.copy foundcell.select activecell.offset(1, -activecell.column + 1).select selection.resize(1, 12).select activesheet.paste application.cutcopymode = false foundcell.select activecell.offset(1, -activecell.column + 1).select selection.resize(1, 12).select selection.borders(xldiagonaldown).linestyle = xlnone selection.borders(xldiagonalup).linestyle = xlnone with selection.borders(xledgeleft) linestyle = xldashdot weight = xlthin colorindex = xlautomatic end with with selection.borders(xledgetop) linestyle = xldashdot weight = xlthin colorindex = xlautomatic end with with selection.borders(xledgebottom) linestyle = xldashdot weight = xlthin colorindex = xlautomatic end with with selection.borders(xledgeright) linestyle = xldashdot weight = xlthin colorindex = xlautomatic end with foundcell.select activecell.offset(1, -activecell.column + 1).select selection.interior.colorindex = 37 activecell.offset(0, 8).select application.screenupdating = true end sub -- cdde ------------------------------------------------------------------------ cdde's Profile: http://www.excelforum.com/member.php...o&userid=15532 View this thread: http://www.excelforum.com/showthread...hreadid=271393 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Dont know if this is possible to do | Excel Discussion (Misc queries) | |||
I know what I need but dont know how to do it | Excel Worksheet Functions | |||
button awareness. i dont know if it can be done. | Excel Programming | |||
Imitating Pivot table's context awareness | Excel Programming | |||
Dont know how? | Excel Programming |