VBA - Resizing chart source data not working

Uzma Shaheen

Active Member
Joined
Nov 10, 2012
Messages
484
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
  2. Mobile
  3. Web
Hi all -

Im trying to resize my chart but this aint working coming up with the error message "the item specified werent found"

Here is the code
Code:
Public Sub test2()
 
 Dim rngPaste As Range
 Dim StartCell As Long
 Dim EndCell As Long
 
 Worksheets("Daily1").Range("C195:E200").ClearContents
 
 StartCell = Worksheets("Daily1").Range("C194").Value
 EndCell = Worksheets("Daily1").Range("d194").Value
 Set rngPaste = Worksheets("Daily1").Range("C195")
 
    Worksheets("Daily1").Cells(195, StartCell).Resize(6, EndCell).Copy
    rngPaste.PasteSpecial xlPasteValuesAndNumberFormats
 




    Worksheets("DailyView1").ChartObjects("WkChart").Chart.SetSourceData Source:=Sheets("Daily1").Range("B195:B200").Resize(, EndCell)
End Sub
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
actually the sheet name should be "Daily1" but its still not liking the resize property



Worksheets("DailyView1").ChartObjects("WkChart").Chart.SetSourceData Source:=Sheets("Daily1").Range("B195:B200").Resize(, EndCell)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,216,480
Messages
6,130,905
Members
449,606
Latest member
jaybar0812

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