Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 201
Default 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
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copying problem MartinW Excel Worksheet Functions 7 April 14th 06 06:12 PM
prevent button from copying David Excel Programming 1 December 25th 05 11:01 AM
Matching and copying problem benneter Excel Programming 1 September 2nd 05 11:55 PM
Copying a button with code into another workbook Daniel Lees Excel Discussion (Misc queries) 1 August 15th 05 01:39 PM
Copying Problem Michael[_10_] Excel Programming 1 August 27th 03 09:18 AM


All times are GMT +1. The time now is 10:04 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"