Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 127
Default Problem with list not showing after a macro running

Dear experts,
I was trying to write a macro to select all shapes in an active sheet except
2 macro buttons.
I have been looking on the treads and used the below code. It works, only
after I have run it the list that I had in one of the cells on my sheet
(data--validation--list) is not showing any longer!

Can you please help me? I am using Excel 2003.
Many thanks in advance,
Best regards

Valeria

Dim Shp As Object
Dim InitialShape As Boolean

InitialShape = True

For Each Shp In ActiveSheet.Shapes
If Shp.Name = "Button 259" Then
'skip it
ElseIf Shp.Name = "Button 254" Then
'skip it
Else
Shp.Select Replace:=InitialShape
InitialShape = False
Shp.Delete
End If

Next Shp

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Problem with list not showing after a macro running

The bad news is that there are lots of shapes that you may want to keep
(comments, autofilter arrows, datavalidation arrows).

Ron de Bruin has lots of tips he
http://www.rondebruin.nl/controlsobjectsworksheet.htm

So maybe...

Option Explicit
Sub shapes2()
Dim shp As Shape

For Each shp In ActiveSheet.Shapes
On Error Resume Next
If shp.TopLeftCell Is Nothing Then
'skip it
Else
Select Case LCase(shp.Name)
Case Is = LCase("Button 259"), LCase("Button 254")
'skip it
Case Else
shp.Delete
End Select
End If
On Error GoTo 0
Next shp
End Sub

But test this against a copy of the worksheet--or save before you run it, so you
can close without saving if it blows up!

If it doesn't work correctly, maybe you could post more information about the
shapes you want to delete--where they came from (Forms toolbar, control toolbox
toolbar, drawing toolbar) and what they are.




Valeria wrote:

Dear experts,
I was trying to write a macro to select all shapes in an active sheet except
2 macro buttons.
I have been looking on the treads and used the below code. It works, only
after I have run it the list that I had in one of the cells on my sheet
(data--validation--list) is not showing any longer!

Can you please help me? I am using Excel 2003.
Many thanks in advance,
Best regards

Valeria

Dim Shp As Object
Dim InitialShape As Boolean

InitialShape = True

For Each Shp In ActiveSheet.Shapes
If Shp.Name = "Button 259" Then
'skip it
ElseIf Shp.Name = "Button 254" Then
'skip it
Else
Shp.Select Replace:=InitialShape
InitialShape = False
Shp.Delete
End If

Next Shp


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 127
Default Problem with list not showing after a macro running

Hello Dave,
I have tested your code and it works perfectly, thank you! In fact, the only
thing I want to delete are images (pasted into Excel) and groups of images,
however aside from the 2 macro buttons I have no other shapes in the
worksheet.
Again thanks,
Kind regards,
--
Valeria


"Dave Peterson" wrote:

The bad news is that there are lots of shapes that you may want to keep
(comments, autofilter arrows, datavalidation arrows).

Ron de Bruin has lots of tips he
http://www.rondebruin.nl/controlsobjectsworksheet.htm

So maybe...

Option Explicit
Sub shapes2()
Dim shp As Shape

For Each shp In ActiveSheet.Shapes
On Error Resume Next
If shp.TopLeftCell Is Nothing Then
'skip it
Else
Select Case LCase(shp.Name)
Case Is = LCase("Button 259"), LCase("Button 254")
'skip it
Case Else
shp.Delete
End Select
End If
On Error GoTo 0
Next shp
End Sub

But test this against a copy of the worksheet--or save before you run it, so you
can close without saving if it blows up!

If it doesn't work correctly, maybe you could post more information about the
shapes you want to delete--where they came from (Forms toolbar, control toolbox
toolbar, drawing toolbar) and what they are.




Valeria wrote:

Dear experts,
I was trying to write a macro to select all shapes in an active sheet except
2 macro buttons.
I have been looking on the treads and used the below code. It works, only
after I have run it the list that I had in one of the cells on my sheet
(data--validation--list) is not showing any longer!

Can you please help me? I am using Excel 2003.
Many thanks in advance,
Best regards

Valeria

Dim Shp As Object
Dim InitialShape As Boolean

InitialShape = True

For Each Shp In ActiveSheet.Shapes
If Shp.Name = "Button 259" Then
'skip it
ElseIf Shp.Name = "Button 254" Then
'skip it
Else
Shp.Select Replace:=InitialShape
InitialShape = False
Shp.Delete
End If

Next Shp


--

Dave Peterson

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Problem with list not showing after a macro running

Be careful with your language <bg.

You had other shapes--the data|validation dropdown arrow is a shape that you
want to keep.



Valeria wrote:

Hello Dave,
I have tested your code and it works perfectly, thank you! In fact, the only
thing I want to delete are images (pasted into Excel) and groups of images,
however aside from the 2 macro buttons I have no other shapes in the
worksheet.
Again thanks,
Kind regards,
--
Valeria

"Dave Peterson" wrote:

The bad news is that there are lots of shapes that you may want to keep
(comments, autofilter arrows, datavalidation arrows).

Ron de Bruin has lots of tips he
http://www.rondebruin.nl/controlsobjectsworksheet.htm

So maybe...

Option Explicit
Sub shapes2()
Dim shp As Shape

For Each shp In ActiveSheet.Shapes
On Error Resume Next
If shp.TopLeftCell Is Nothing Then
'skip it
Else
Select Case LCase(shp.Name)
Case Is = LCase("Button 259"), LCase("Button 254")
'skip it
Case Else
shp.Delete
End Select
End If
On Error GoTo 0
Next shp
End Sub

But test this against a copy of the worksheet--or save before you run it, so you
can close without saving if it blows up!

If it doesn't work correctly, maybe you could post more information about the
shapes you want to delete--where they came from (Forms toolbar, control toolbox
toolbar, drawing toolbar) and what they are.




Valeria wrote:

Dear experts,
I was trying to write a macro to select all shapes in an active sheet except
2 macro buttons.
I have been looking on the treads and used the below code. It works, only
after I have run it the list that I had in one of the cells on my sheet
(data--validation--list) is not showing any longer!

Can you please help me? I am using Excel 2003.
Many thanks in advance,
Best regards

Valeria

Dim Shp As Object
Dim InitialShape As Boolean

InitialShape = True

For Each Shp In ActiveSheet.Shapes
If Shp.Name = "Button 259" Then
'skip it
ElseIf Shp.Name = "Button 254" Then
'skip it
Else
Shp.Select Replace:=InitialShape
InitialShape = False
Shp.Delete
End If

Next Shp


--

Dave Peterson


--

Dave Peterson
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
Problem in running a macro from VB6 Naga Excel Discussion (Misc queries) 1 August 30th 06 12:10 AM
running a macro from a list rufusf Excel Worksheet Functions 0 February 22nd 06 04:38 PM
Macros in personal.xls not all showing up in Tools|Macro List zharrisonremoveatgmail.com Excel Programming 1 August 16th 05 09:48 PM
Why did XL stopped showing me the Macro Commands List Martyn Excel Programming 19 February 17th 04 07:14 AM
Why did XL stopped showing me the Macro Commands list? Martyn Excel Programming 0 February 15th 04 07:24 AM


All times are GMT +1. The time now is 05:27 AM.

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

About Us

"It's about Microsoft Excel"