![]() |
Problem with copying a button in VB
With VB I am trying to copy two columns, one of which has a button in it. I recorded the below into a module. Columns("J:K").Select Selection.Copy Columns("L:L").Select Selection.Insert Shift:=xlToRight ActiveSheet.Shapes("Button 6").Select Application.CutCopyMode = False Selection.Characters.Text = "test" With Selection.Characters(Start:=1, Length:=4).Font .Name = "Arial" .FontStyle = "Bold" .Size = 10 .Strikethrough = False .Superscript = False .Subscript = False .OutlineFont = False .Shadow = False .Underline = xlUnderlineStyleNone .ColorIndex = 5 End With Range("M25").Select Problem 1. I have several rows where columns B:J are merged. When I run the first line of code above, it actually selects B:J not J:K even though this worked during the record process. Is there a way of codeing this so I only select/copy columns J and K? Problem 2. Cell K19 contains a button, when it gets copied excel gives the button copy the same name as the button in K19. So again while this work in practice, when I rerun the code ActiveSheet.Shapes("Button 6").Select selects the button in K19 not my new button. This now prevents me renaming the new button and therefore any further reference to it. I presume there is a better way I can do this, but this has stumped me for now, any ideas? -- Trefor |
All times are GMT +1. The time now is 09:06 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com