Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Whats wrong with this code ?

Status
Not open for further replies.

wmbb

Technical User
Jul 17, 2005
320
NL
I get an error using the code below....

Code:
DbaseArray = ThisWorkbook.Sheets("test").Range("A1:K100")

leaving out the first part ThisWorkbook.Sheets("test"). the code is correct ??!!
But I need to point to that specific sheet...

Am I missing something ?

The Sheet "test" does exist !
 
Type mismatch (error 13)
 
Using the code below does also work but I'm wondering whats wrong with the first code...

Code:
ThisWorkbook.Sheets("test").Select
DbaseArray = Range("A1:K100")
 
I have no problems with your initial code, even for hidden sheet.Is DbaseArray dimmed? As variant?


combo
 
Yes it is...

I get this error on 3 different systems now in office 2016

It seems that the combination sheets("test") with .range causes the problem...??
 
Very strange ....
If I use the code below it also works

Code:
Dim ws As Worksheet
    Set ws = ThisWorkbook.Sheets("test")
    DbaseArray = ws.Range("A1:K100")

Very strange...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top