Multiple sheets

Xmas

New Member
Joined
Dec 21, 2009
Messages
45
I have some code that works -though I'm sure it could be done much more elegantly. Anyway, what I want to do is add an IF condition (the last one) that lists all results from all the IF codes above on the one Word document. It would be great if every picture were on a separate page. Any help would be much appreciated. Here is the code at present.

Sub SkOmdWordMåltabell()

Application.ScreenUpdating = False
Dim wordApp As Word.Application 'Object
Dim WordDoc As Word.Document 'Object 'Word.Document

Set wordApp = CreateObject("Word.Application")
wordApp.Visible = True

Set WordDoc = wordApp.Documents.Open("C:\Users\graeme a\Documents\Kursplaner\bb.docm")

If Sheets("SkOmdAlla").Range("I7").Interior.Color = 65535 Then Sheets("1").Select
If Sheets("SkOmdAlla").Range("I8").Interior.Color = 65535 Then Sheets("2").Select
If Sheets("SkOmdAlla").Range("I9").Interior.Color = 65535 Then Sheets("3").Select
If Sheets("SkOmdAlla").Range("I10").Interior.Color = 65535 Then Sheets("4").Select
If Sheets("SkOmdAlla").Range("I11").Interior.Color = 65535 Then Sheets("5").Select
If Sheets("SkOmdAlla").Range("I12").Interior.Color = 65535 Then Sheets("6").Select
If Sheets("SkOmdAlla").Range("I13").Interior.Color = 65535 Then Sheets("7").Select
If Sheets("SkOmdAlla").Range("I14").Interior.Color = 65535 Then Sheets("8").Select
If Sheets("SkOmdAlla").Range("I15").Interior.Color = 65535 Then Sheets("9").Select
If Sheets("SkOmdAlla").Range("I16").Interior.Color = 65535 Then Sheets("10").Select
If Sheets("SkOmdAlla").Range("I17").Interior.Color = 65535 Then Sheets("11").Select
If Sheets("SkOmdAlla").Range("I18").Interior.Color = 65535 Then Sheets("12").Select
If Sheets("SkOmdAlla").Range("I19").Interior.Color = 65535 Then Sheets("13").Select
If Sheets("SkOmdAlla").Range("I20").Interior.Color = 65535 Then Sheets("14").Select
If Sheets("SkOmdAlla").Range("I21").Interior.Color = 65535 Then Sheets("15").Select
If Sheets("SkOmdAlla").Range("I22").Interior.Color = 65535 Then Sheets("16").Select
If Sheets("SkOmdAlla").Range("I23").Interior.Color = 65535 Then Sheets("17").Select
If Sheets("SkOmdAlla").Range("I24").Interior.Color = 65535 Then Sheets("18").Select
If Sheets("SkOmdAlla").Range("I25").Interior.Color = 65535 Then Sheets("19").Select
If Sheets("SkOmdAlla").Range("I26").Interior.Color = 65535 Then Sheets("20").Select
If Sheets("SkOmdAlla").Range("I27").Interior.Color = 65535 Then Sheets("21").Select
If Sheets("SkOmdAlla").Range("I28").Interior.Color = 65535 Then Sheets("22").Select
If Sheets("SkOmdAlla").Range("I29").Interior.Color = 65535 Then Sheets("23").Select
If Sheets("SkOmdAlla").Range("I30").Interior.Color = 65535 Then Sheets("24").Select
If Sheets("SkOmdAlla").Range("I31").Interior.Color = 65535 Then Sheets("25").Select

If Sheets("SkOmdAlla").Range("I33").Interior.Color = 65535 Then Sheets ???

Range("A1:AG21").Copy
Sheets("SkOmdAlla").Activate

wordApp.Selection.PasteSpecial Link:=False, _
DataType:=wdPasteEnhancedMetafile, _
Placement:=wdInLine, _
DisplayAsIcon:=False

WordDoc.Save


Set WordDoc = Nothing
Set wordApp = Nothing

Application.CutCopyMode = False
Application.ScreenUpdating = True

End Sub
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN

Forum statistics

Threads
1,224,587
Messages
6,179,735
Members
452,939
Latest member
WCrawford

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top