• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 206
  • Last Modified:

Application Defined or Object defined error

Set BaseWks = ActiveSheet

Sheets("GL Summary").Range("A1:G").CurrentRegion.Name = "Ranges"

Open in new window


Hi,

I am getting the 'Application Defined or Object defined error' on above line.

Using examples in this forum, I tried this

Set BaseWks = ActiveSheet

basewks.Range("A1:G").CurrentRegion.Name = "Ranges"

Open in new window


Then it gave me, 'method range of object worksheet failed' error :o

Any help is much appreicated!
I am trying to assign the region as an array for my dynamic pivot table!

Thanks!


0
Shanan212
Asked:
Shanan212
  • 2
  • 2
1 Solution
 
StephenJRCommented:
Try thus:
basewks.Range("A1").CurrentRegion.Name = "Ranges"

Open in new window

0
 
Shanan212Author Commented:
I tried that originally but that picked up unnessary data outside of column G. I got it to work now using this!

    Dim tblRng As Range
    Set tblRng = BaseWks.Range("A1:G" & BaseWks.Range("A" & BaseWks.Rows.Count).End(xlUp).Row)
    tblRng.Name = "Ranges"

Open in new window

0
 
Shanan212Author Commented:
this works now
0
 
StephenJRCommented:
Perhaps you can get in the habit of testing things before you ask the question.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now