#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 49
Default Picture # assignment


My book has many pictures.
Picture #s kept going higher and higher every time I made a change to the
book and the #s were skipping.
Is there a way to get a list of the Picture #s in the book.
I want to rename all the Pictures to a low # start and more consecutive.
Thanks
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,934
Default Picture # assignment

You can run this line of code in the Immediate window of the Visual Basic
editor and it will list the names of all shapes on the specified sheet...

For Each S In Sheet1.Shapes : ? S.Name : Next

--
Rick (MVP - Excel)


"danpt" wrote in message
...

My book has many pictures.
Picture #s kept going higher and higher every time I made a change to the
book and the #s were skipping.
Is there a way to get a list of the Picture #s in the book.
I want to rename all the Pictures to a low # start and more consecutive.
Thanks


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 49
Default Picture # assignment

Hi, Rick
Glad to hear you again.

Sub PictureList()
For Each S In Sheet1.Shapes: Print S.Name: Next
End Sub

I got a
Compile error: Mathod not valid without suitable object
I'm new to this. Please refine it.


"Rick Rothstein" wrote:

You can run this line of code in the Immediate window of the Visual Basic
editor and it will list the names of all shapes on the specified sheet...

For Each S In Sheet1.Shapes : ? S.Name : Next

--
Rick (MVP - Excel)


"danpt" wrote in message
...

My book has many pictures.
Picture #s kept going higher and higher every time I made a change to the
book and the #s were skipping.
Is there a way to get a list of the Picture #s in the book.
I want to rename all the Pictures to a low # start and more consecutive.
Thanks



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Picture # assignment

On a sheet select all pictures then run this macro.

Public Sub ReNamePics()
Dim Pic As Shape, K As Long
For Each Pic In Selection.ShapeRange
K = K + 1
Pic.Name = "MyPic" & K
Next Pic
End Sub

Or run this is you have a list of names to use.

Sub Rename_Pics22()
'select all pictures then rename with a list starting at A2
Dim Pic As Shape
Dim rng As Range
Dim i As Integer
On Error GoTo endit
Set rng = Range("A2")
For Each Pic In Selection.ShapeRange
Pic.Name = rng.Offset(i, 0).Value
i = i + 1
Next Pic
Exit Sub
endit:
MsgBox "there is a picture by that name, re-type a name"
End Sub


Gord Dibben MS Excel MVP

On Thu, 2 Apr 2009 21:52:04 -0700, danpt
wrote:


My book has many pictures.
Picture #s kept going higher and higher every time I made a change to the
book and the #s were skipping.
Is there a way to get a list of the Picture #s in the book.
I want to rename all the Pictures to a low # start and more consecutive.
Thanks


  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,934
Default Picture # assignment

You didn't do what I said to do... run the single line of code I posted in
the Immediate window. I think you had a problem because you tried to make it
a macro... the Print statement has no meaning in a macro. If you want to
keep it as a macro, change the keyword Print to Debug.Print

--
Rick (MVP - Excel)


"danpt" wrote in message
...
Hi, Rick
Glad to hear you again.

Sub PictureList()
For Each S In Sheet1.Shapes: Print S.Name: Next
End Sub

I got a
Compile error: Mathod not valid without suitable object
I'm new to this. Please refine it.


"Rick Rothstein" wrote:

You can run this line of code in the Immediate window of the Visual Basic
editor and it will list the names of all shapes on the specified sheet...

For Each S In Sheet1.Shapes : ? S.Name : Next

--
Rick (MVP - Excel)


"danpt" wrote in message
...

My book has many pictures.
Picture #s kept going higher and higher every time I made a change to
the
book and the #s were skipping.
Is there a way to get a list of the Picture #s in the book.
I want to rename all the Pictures to a low # start and more
consecutive.
Thanks






  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 49
Default Picture # assignment

Hi, Rick
Not because I didn't want to, but simply I'm igorant on how to.
Will you walk me through - !! Help !!
It is of great importance for me to get this.

"Rick Rothstein" wrote:

You didn't do what I said to do... run the single line of code I posted in
the Immediate window. I think you had a problem because you tried to make it
a macro... the Print statement has no meaning in a macro. If you want to
keep it as a macro, change the keyword Print to Debug.Print

--
Rick (MVP - Excel)


"danpt" wrote in message
...
Hi, Rick
Glad to hear you again.

Sub PictureList()
For Each S In Sheet1.Shapes: Print S.Name: Next
End Sub

I got a
Compile error: Mathod not valid without suitable object
I'm new to this. Please refine it.


"Rick Rothstein" wrote:

You can run this line of code in the Immediate window of the Visual Basic
editor and it will list the names of all shapes on the specified sheet...

For Each S In Sheet1.Shapes : ? S.Name : Next

--
Rick (MVP - Excel)


"danpt" wrote in message
...

My book has many pictures.
Picture #s kept going higher and higher every time I made a change to
the
book and the #s were skipping.
Is there a way to get a list of the Picture #s in the book.
I want to rename all the Pictures to a low # start and more
consecutive.
Thanks




  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 49
Default Picture # assignment

Many thanks, Gord
I found out that I couldn't use
Pic.Name = "Picture " & K
Is it correct?

"Gord Dibben" wrote:

On a sheet select all pictures then run this macro.

Public Sub ReNamePics()
Dim Pic As Shape, K As Long
For Each Pic In Selection.ShapeRange
K = K + 1
Pic.Name = "MyPic" & K
Next Pic
End Sub

Or run this is you have a list of names to use.

Sub Rename_Pics22()
'select all pictures then rename with a list starting at A2
Dim Pic As Shape
Dim rng As Range
Dim i As Integer
On Error GoTo endit
Set rng = Range("A2")
For Each Pic In Selection.ShapeRange
Pic.Name = rng.Offset(i, 0).Value
i = i + 1
Next Pic
Exit Sub
endit:
MsgBox "there is a picture by that name, re-type a name"
End Sub


Gord Dibben MS Excel MVP

On Thu, 2 Apr 2009 21:52:04 -0700, danpt
wrote:


My book has many pictures.
Picture #s kept going higher and higher every time I made a change to the
book and the #s were skipping.
Is there a way to get a list of the Picture #s in the book.
I want to rename all the Pictures to a low # start and more consecutive.
Thanks



  #8   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Picture # assignment

You are correct.

Doesn't like the space in "Picture "

Not sure why but will ponder on that a while.

Try this revision...................rename by double-naming then rename
again.

Public Sub ReNamePics()
Dim Pic As Shape, K As Long
For Each Pic In Selection.ShapeRange
Pic.Name = Pic.Name & Pic.Name
Next Pic
For Each Pic In Selection.ShapeRange
K = K + 1
Pic.Name = "Picture " & K
Next Pic
End Sub


Gord

On Fri, 3 Apr 2009 14:51:01 -0700, danpt
wrote:

Many thanks, Gord
I found out that I couldn't use
Pic.Name = "Picture " & K
Is it correct?

"Gord Dibben" wrote:

On a sheet select all pictures then run this macro.

Public Sub ReNamePics()
Dim Pic As Shape, K As Long
For Each Pic In Selection.ShapeRange
K = K + 1
Pic.Name = "MyPic" & K
Next Pic
End Sub

Or run this is you have a list of names to use.

Sub Rename_Pics22()
'select all pictures then rename with a list starting at A2
Dim Pic As Shape
Dim rng As Range
Dim i As Integer
On Error GoTo endit
Set rng = Range("A2")
For Each Pic In Selection.ShapeRange
Pic.Name = rng.Offset(i, 0).Value
i = i + 1
Next Pic
Exit Sub
endit:
MsgBox "there is a picture by that name, re-type a name"
End Sub


Gord Dibben MS Excel MVP

On Thu, 2 Apr 2009 21:52:04 -0700, danpt
wrote:


My book has many pictures.
Picture #s kept going higher and higher every time I made a change to the
book and the #s were skipping.
Is there a way to get a list of the Picture #s in the book.
I want to rename all the Pictures to a low # start and more consecutive.
Thanks




  #9   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 49
Default Picture # assignment

No, still no good


"Gord Dibben" wrote:

You are correct.

Doesn't like the space in "Picture "

Not sure why but will ponder on that a while.

Try this revision...................rename by double-naming then rename
again.

Public Sub ReNamePics()
Dim Pic As Shape, K As Long
For Each Pic In Selection.ShapeRange
Pic.Name = Pic.Name & Pic.Name
Next Pic
For Each Pic In Selection.ShapeRange
K = K + 1
Pic.Name = "Picture " & K
Next Pic
End Sub


Gord

On Fri, 3 Apr 2009 14:51:01 -0700, danpt
wrote:

Many thanks, Gord
I found out that I couldn't use
Pic.Name = "Picture " & K
Is it correct?

"Gord Dibben" wrote:

On a sheet select all pictures then run this macro.

Public Sub ReNamePics()
Dim Pic As Shape, K As Long
For Each Pic In Selection.ShapeRange
K = K + 1
Pic.Name = "MyPic" & K
Next Pic
End Sub

Or run this is you have a list of names to use.

Sub Rename_Pics22()
'select all pictures then rename with a list starting at A2
Dim Pic As Shape
Dim rng As Range
Dim i As Integer
On Error GoTo endit
Set rng = Range("A2")
For Each Pic In Selection.ShapeRange
Pic.Name = rng.Offset(i, 0).Value
i = i + 1
Next Pic
Exit Sub
endit:
MsgBox "there is a picture by that name, re-type a name"
End Sub


Gord Dibben MS Excel MVP

On Thu, 2 Apr 2009 21:52:04 -0700, danpt
wrote:


My book has many pictures.
Picture #s kept going higher and higher every time I made a change to the
book and the #s were skipping.
Is there a way to get a list of the Picture #s in the book.
I want to rename all the Pictures to a low # start and more consecutive.
Thanks




  #10   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Picture # assignment

Haven't yet found a method to use a space with "Picture "

No problem with a space in any string except that.

I guess you'll just have to rename to something else or leave out the space.


Gord


On Sat, 4 Apr 2009 10:34:01 -0700, danpt
wrote:

No, still no good


"Gord Dibben" wrote:

You are correct.

Doesn't like the space in "Picture "

Not sure why but will ponder on that a while.

Try this revision...................rename by double-naming then rename
again.

Public Sub ReNamePics()
Dim Pic As Shape, K As Long
For Each Pic In Selection.ShapeRange
Pic.Name = Pic.Name & Pic.Name
Next Pic
For Each Pic In Selection.ShapeRange
K = K + 1
Pic.Name = "Picture " & K
Next Pic
End Sub


Gord

On Fri, 3 Apr 2009 14:51:01 -0700, danpt
wrote:

Many thanks, Gord
I found out that I couldn't use
Pic.Name = "Picture " & K
Is it correct?

"Gord Dibben" wrote:

On a sheet select all pictures then run this macro.

Public Sub ReNamePics()
Dim Pic As Shape, K As Long
For Each Pic In Selection.ShapeRange
K = K + 1
Pic.Name = "MyPic" & K
Next Pic
End Sub

Or run this is you have a list of names to use.

Sub Rename_Pics22()
'select all pictures then rename with a list starting at A2
Dim Pic As Shape
Dim rng As Range
Dim i As Integer
On Error GoTo endit
Set rng = Range("A2")
For Each Pic In Selection.ShapeRange
Pic.Name = rng.Offset(i, 0).Value
i = i + 1
Next Pic
Exit Sub
endit:
MsgBox "there is a picture by that name, re-type a name"
End Sub


Gord Dibben MS Excel MVP

On Thu, 2 Apr 2009 21:52:04 -0700, danpt
wrote:


My book has many pictures.
Picture #s kept going higher and higher every time I made a change to the
book and the #s were skipping.
Is there a way to get a list of the Picture #s in the book.
I want to rename all the Pictures to a low # start and more consecutive.
Thanks





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
Number Assignment GRK Excel Worksheet Functions 3 April 26th 08 12:31 AM
point assignment Blah Excel Discussion (Misc queries) 4 July 21st 06 12:29 AM
help with assignment within next 24hrs icecoldmike Excel Discussion (Misc queries) 0 April 6th 06 01:31 AM
Key Assignment Log Norma Excel Discussion (Misc queries) 0 May 12th 05 04:10 PM
assignment problem L. Chung Excel Worksheet Functions 1 April 17th 05 06:06 AM


All times are GMT +1. The time now is 06:21 PM.

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"