-
WSjha900
AskWoody Loungersorry, this is entire code
Very long piece of code (8400 characters!) moved to attachment by HansV
-
WSjha900
AskWoody LoungerThanks very much. That works great.
Now I am trying to change it to format 3 rows of headers that appear throughout the file. The properly formatted rows are 5:7. I want to search for the word TOTAL in B25-B500 and format the row above and below the found row like rows 5:7.
Have tried this…
Dim rngTC As Range
Dim rngCell As RangeRange(“A1”).Select
On Error Resume Next
Set rngTC = ActiveSheet.Columns(“B25:B500”).SpecialCells(xlCellTypeConstants, 2)If Not rngTC Is Nothing Then
For Each rngCell In rngTC
If InStr(1, rngCell.Value, “TOTAL”, vbTextCompare) > 0 Then
rngCell.SelectRows(“5:7”).Select
Selection.Copy
rngCell.EntireRow.Offset(-1, 0).Rows(3).Select
Selection.PasteSpecial Paste:=xlPasteFormats
End If
Next rngCell
End If -
WSjha900
AskWoody LoungerThis is a tremendous help! thank you very much
-
WSjha900
AskWoody LoungerOh, it’s my backwards way of getting to the 2nd ole object on the slide and positioning it the same as the 2nd object on ppt1
I thought the ppt2.Slides(i).Shapes(k).ZOrder msoSendBack
would send the ole object to the back but it doesn’t. Is there another way to make it go to the back? Right now it is in front of the textbox where the user writes bullet points. -
WSjha900
AskWoody LoungerNow I’m trying to move the ole object to the back so the text box is in the front on the ppt file. I’ve tried this….
Sub FixCharts()
Dim ppt1 As Presentation
Dim ppt2 As Presentation
Dim i As Integer
Dim j As Integer
Dim k As Integer
On Error Resume NextSet ppt1 = Presentations(“cigarettes.ppt”)
Set ppt2 = Presentations(“Yogurt 2.ppt”)For i = 1 To ppt1.Slides.Count
For j = 1 To ppt1.Slides(i).Shapes.Count
If ppt1.Slides(i).Shapes(j).Type = msoLinkedOLEObject Then
For k = 1 To ppt2.Slides(i).Shapes.Count
If ppt2.Slides(i).Shapes(k).Type = msoLinkedOLEObject Then
‘ x = ppt2.Slides(i).Shapes(k).Name
‘ MsgBox x
Exit For
End If
Next k
ppt2.Slides(i).Shapes(k).Top = ppt1.Slides(i).Shapes(j).Top
ppt2.Slides(i).Shapes(k).Left = ppt1.Slides(i).Shapes(j).Left
ppt2.Slides(i).Shapes(k).Height = ppt1.Slides(i).Shapes(j).Height
ppt2.Slides(i).Shapes(k).Width = ppt1.Slides(i).Shapes(j).Width
ppt2.Slides(i).Shapes(k).ZOrder msoSendBackIf Not ppt2.Slides(i).Shapes(k + 1) Then
ppt2.Slides(i).Shapes(k + 1).Top = ppt1.Slides(i).Shapes(j + 1).Top
ppt2.Slides(i).Shapes(k + 1).Left = ppt1.Slides(i).Shapes(j + 1).Left
ppt2.Slides(i).Shapes(k + 1).Height = ppt1.Slides(i).Shapes(j + 1).Height
ppt2.Slides(i).Shapes(k + 1).Width = ppt1.Slides(i).Shapes(j + 1).WidthEnd If
Exit For
End If
Next j
Next iSet ppt2 = Nothing
Set ppt1 = NothingMsgBox (“slides match”)
End SubIs there a different method to use because this doesn’t work? Thank you for the help.
-
WSjha900
AskWoody LoungerHi Hans,
I can’t figure out where to find the “name” of the shape in ppt. I was trying to debug the below but i cannot figure out either in Excel or ppt how I can “see” the name of the chart
Sub MatchSizePositionTemplatePPT()
Dim ppt1 As Presentation
Dim ppt2 As Presentation
Dim i As Integer
Dim j As Integer
Dim k As Integer
‘On Error Resume NextSet ppt1 = Presentations(“cigarettes.ppt”)
Set ppt2 = Presentations(“yogurt.ppt”)For i = 1 To ppt1.Slides.Count
For j = 1 To ppt1.Slides(i).Shapes.Count
If ppt1.Slides(i).Shapes(j).Type = msoLinkedOLEObject Then
If ppt1.Slides(i).Shapes(j).Name = i & “A” Or ppt1.Slides(i).Shapes(j).Name = i & “B” ThenFor k = 1 To ppt2.Slides(i).Shapes.Count
If ppt2.Slides(i).Shapes(k).Type = msoLinkedOLEObject Then
Exit For
End If
Next k
ppt2.Slides(i).Shapes(k).Top = ppt1.Slides(i).Shapes(j).Top
ppt2.Slides(i).Shapes(k).Left = ppt1.Slides(i).Shapes(j).Left
ppt2.Slides(i).Shapes(k).Height = ppt1.Slides(i).Shapes(j).Height
ppt2.Slides(i).Shapes(k).Width = ppt1.Slides(i).Shapes(j).Width
Exit For
End If
End If
Next j
Next iSet ppt2 = Nothing
Set ppt1 = Nothing
End Sub -
WSjha900
AskWoody Loungereach chart is named the slide number plus an “A” if there is 1 chart and a “B” if there is a second chart. So if slide 25 has 2 charts they are named 25A and 25B
-
WSjha900
AskWoody Loungeryes, that is what i mean. I don’t know how to dim the chart sheets and loop through them.
-
WSjha900
AskWoody Loungerok, thank you very much. I am using this but it is skipping the chart worksheets. How do i specify chart sheets as well as worksheets?
Sub Scale100()
Dim wsh As Worksheet
On Error Resume NextFor Each wsh In ActiveWorkbook.Worksheets
wsh.Select
With ActiveWindow.Selection.ShapeRange
.ScaleHeight 1#, msoTrue
.ScaleWidth 1#, msoTrue
End With
Next wsh
Set wsh = Nothing
MsgBox (“Done”)End Sub
-
WSjha900
AskWoody LoungerThis works great. I forgot that there are several instances where 2 charts (ole objects) are on the same slide. How can I modify the macro to take that into account? Thank you
-
WSjha900
AskWoody Loungerwow! woopie, this works wonderfully. Saved me TONS of time. Can’t thank you enough!
-
WSjha900
AskWoody LoungerThe charts are already in the ppt files.
-
WSjha900
AskWoody Loungeryes, unfortunately there are other elements such as footnote, title, page number. The chart usually sits in the middle of the slide but the “size” of it is different on each slide. There are pies, horiz and vert bar graphs, and stacked bar graphs.
-
WSjha900
AskWoody Loungeryes, worked perfectly. thanks very much
-
WSjha900
AskWoody Loungeroh, sorry. I mean the actual chart on the chart sheet. I need to “name” this chart because it gets paste linked into a powerpoint file and I need to access the chart by it’s name in powerpoint.
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
The time has come for AI-generated art
by
Catherine Barrett
57 minutes ago -
Hackers are using two-factor authentication to infect you
by
B. Livingston
58 minutes ago -
23 and you
by
Max Stul Oppenheimer
59 minutes ago -
April’s deluge of patches
by
Susan Bradley
20 minutes ago -
April’s deluge of patches
by
Susan Bradley
1 hour ago -
Windows 11 Windows Updater question
by
Tex265
9 hours, 11 minutes ago -
Key, Key, my kingdom for a Key!
by
RetiredGeek
16 hours, 6 minutes ago -
Registry Patches for Windows 10
by
Drcard:))
20 hours, 37 minutes ago -
Cannot get line length to NOT wrap in Outlining in Word 365
by
CWBillow
3 hours, 11 minutes ago -
DDU (Display Driver Uninstaller) updates
by
Alex5723
13 hours, 59 minutes ago -
Align objects on a OneNote page
by
CWBillow
1 day, 2 hours ago -
OneNote Send To button?
by
CWBillow
1 day, 2 hours ago -
WU help needed with “Some settings are managed by your organization”
by
Peobody
1 day, 11 hours ago -
No Newsletters since 27 January
by
rog7
1 day, 7 hours ago -
Linux Mint Debian Edition 7 gets OEM support, death of Ubuntu-based Mint ?
by
Alex5723
11 hours, 54 minutes ago -
Windows Update “Areca Technology Corporation – System – 6.20.0.41”
by
Bruce
10 hours, 34 minutes ago -
Google One Storage Questions
by
LHiggins
1 hour, 41 minutes ago -
Button Missing for Automatic Apps Updates
by
pmcjr6142
1 hour, 48 minutes ago -
Ancient SSD thinks it’s new
by
WSila
16 hours, 30 minutes ago -
Washington State lab testing provider exposed health data of 1.6 million people
by
Nibbled To Death By Ducks
2 days, 2 hours ago -
WinRE KB5057589 fake out
by
Susan Bradley
1 hour, 14 minutes ago -
The April 2025 Windows RE update might show as unsuccessful in Windows Update
by
Susan Bradley
1 day, 10 hours ago -
Firefox 137
by
Charlie
12 hours, 54 minutes ago -
Whisky, a popular Wine frontend for Mac gamers, is no more
by
Alex5723
2 days, 14 hours ago -
Windows 11 Insider Preview build 26120.3863 (24H2) released to BETA
by
joep517
2 days, 14 hours ago -
Windows 11 Insider Preview build 26200.5551 released to DEV
by
joep517
2 days, 14 hours ago -
New Windows 11 PC setup — can I start over in the middle to set up a local id?
by
ctRanger
1 day, 10 hours ago -
Windows 11 Insider Preview Build 26100.3902 (24H2) released to Release Preview
by
joep517
2 days, 18 hours ago -
Oracle kinda-sorta tells customers it was pwned
by
Nibbled To Death By Ducks
3 days ago -
Global data centers (AI) are driving a big increase in electricity demand
by
Kathy Stevens
3 days, 10 hours ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.