How to fix a Range

jamiguel77

Active Member
Joined
Feb 14, 2006
Messages
387
Office Version
  1. 2016
  2. 2010
  3. 2007
Platform
  1. Windows
  2. Web
hi all
i have this code:

Code:
    Private Const Chart_Source_Range = "Sheet1!$A$1:$B$9"     ' <== Change Chart Source addrs as required
    Range(Chart_Source_Range).Parent.Select
    Application.EnableEvents = True
    Set ws = Range(Chart_Source_Range).Parent
    Set oLbl = Me.Frame1.Controls.Add("Forms.Label.1", "Test", 0)
    Set oChart = CreateChart(Range(Chart_Source_Range), PIE_CHART_TYPE)

my problem is:

i opened a Excel file and stored on a variable named: wbk

i try this:

Set NewSheet = wbk.Sheets("Graficas")
Chart_Source_Range = NewSheet.Range("K66:L78")

in this last line i get an error: 91
Spanish: Variable de objeto o bloque with no establecido

the filename is named: "Budget 2018.xlsx"

how to fix?


thanks
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
i think the variable:

Chart_Source_Range = NewSheet.Range("K66:L78")


have not a String.


how to convert it?


thanks
 
Upvote 0

Forum statistics

Threads
1,223,723
Messages
6,174,123
Members
452,546
Latest member
Rafafa

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