VBA in Powerpoint - Variable Range

zielonapani

New Member
Joined
Sep 5, 2013
Messages
38
Hi,
I am trying to write a code for Powerpoint Macro that will open excel file, copy a range based on the month(so variable range) and copy in the live link into the specific slide.
I think I am pretty close to succed that but i got stuck on the "variable range"
Could you please have a look what I am doing wrong?
Thank you
Code:
Private Sub ExcelImportData()
Dim xlApp As Object
Dim xlWorkBook As Object
Set xlApp = CreateObject("Excel.Application")
Set xlWorkBook = xlApp.Workbooks.Open("\\ukcomaunas01\P2.Order Acquisition\05 Departmental\06 Proposals & Estimating\2017\01 Staff Meeting\CurrentYear\MASTER Quotes by month.xlsx", True, False)
xlApp.Visible = True
Dim Y, Y1 As Date
Dim m1 As String
Y = DateSerial(Year(Now), Month(Now), 0)
m1 = MonthName(Month(Y))
Y1 = Format(Y, "yyyy")
Dim R1  As String
Dim C1 As String
Dim R2  As String
Dim C2 As String
Dim T As String
Dim O As Long
Dim TT As String
Dim TTT As Range
Dim rFind As Range
Dim rng As Range
    With xlWorkBook.sheets("2017").Range("A2:AV2")
        Set rFind = .Find(What:=m1, LookAt:=xlWhole, LookIn:=xlValues, MatchCase:=False, SearchFormat:=False)
    End With
R1 = rFind.Row
C1 = rFind.Column
R2 = rFind.Row + 38
C2 = rFind.Column + 8
T = rFind.Address
[COLOR=#ff0000]TT = Chr(34) & rFind.Address & ":" & xlWorkBook.sheets("2017").Cells(rFind.Row + 7, rFind.Column + 38) & Chr(34)
Set rng = xlWorkBook.sheets("2017").Range(TT)[/COLOR]



rng.Copy
Dim ppt As Presentation
Dim shape As shape

[COLOR=#ff0000]
ActivePresentation.Slides(3).Shapes.PasteSpecial(Link:=True).Select[/COLOR]




Set xlApp = Nothing
Set xlWorkBook = Nothing
End Sub
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.

Forum statistics

Threads
1,215,050
Messages
6,122,868
Members
449,097
Latest member
dbomb1414

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