Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hi, I have a worksheet (sheet1) with four commandbuttons on row1 and I have added a new worksheet (sheet2). When I unprotect sheet1, activate the button "Design Mode" on the "Control Toolbox" toolbar, copy row1 and paste it as row1 on sheet2, the commandbuttons are also copied. When I record this with the macro recorder (see code below) and play the macro afterwards it copies row1 but the commandbuttons are NOT copied. What do I need to change to also copy these commandbuttons? Thanks in advance! Code: -------------------- Sheets("Sheet1").Select Sheets.Add Sheets("Sheet1").Select ActiveSheet.Unprotect Rows("1:1").Select Selection.Copy Sheets("Sheet2").Select Rows("1:1").Select ActiveSheet.Paste -------------------- -- leonidas ------------------------------------------------------------------------ leonidas's Profile: http://www.excelforum.com/member.php...o&userid=35375 View this thread: http://www.excelforum.com/showthread...hreadid=564659 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
leonidas,
Use the commandbuttons from the Forms commandbar, rather than the commandbuttons from the Control Toolbox. You will need to assign a macro rather than use a click event, but the forms commandbuttons can have their properties set to be moved and sized with a range, which makes them 'copy-able' through code. HTH, Bernie MS Excel MVP "leonidas" wrote in message ... Hi, I have a worksheet (sheet1) with four commandbuttons on row1 and I have added a new worksheet (sheet2). When I unprotect sheet1, activate the button "Design Mode" on the "Control Toolbox" toolbar, copy row1 and paste it as row1 on sheet2, the commandbuttons are also copied. When I record this with the macro recorder (see code below) and play the macro afterwards it copies row1 but the commandbuttons are NOT copied. What do I need to change to also copy these commandbuttons? Thanks in advance! Code: -------------------- Sheets("Sheet1").Select Sheets.Add Sheets("Sheet1").Select ActiveSheet.Unprotect Rows("1:1").Select Selection.Copy Sheets("Sheet2").Select Rows("1:1").Select ActiveSheet.Paste -------------------- -- leonidas ------------------------------------------------------------------------ leonidas's Profile: http://www.excelforum.com/member.php...o&userid=35375 View this thread: http://www.excelforum.com/showthread...hreadid=564659 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Help to loop Commandbuttons vertically | Excel Programming | |||
CommandButtons | Excel Programming | |||
Commandbuttons | Excel Programming | |||
Do While, OnTime and CommandButtons | Excel Programming | |||
commandbuttons properties | Excel Programming |