View Single Post
  #3   Report Post  
Bernie Deitrick
 
Posts: n/a
Default

Coolboy55,

I should also have mentioned that when you get rid of your select statements, you need to pay
attention to your range objects, since an unqualified range object defaults to the active sheet.
The range in your statement:

Sheet4.Range("A3", Cells(l_LastRow, l_LastColumn)).Select

would be better written (without the select) as

Sheet4.Range("A3", Sheet4.Cells(l_LastRow, l_LastColumn))

HTH,
Bernie
MS Excel MVP


"Bernie Deitrick" <deitbe @ consumer dot org wrote in message
...
Coolboy55,

You can't select a range on an inactive worksheet. Since you rarely need to select, change your
code to get rid of the .Select commands, or change the code to select sheet4 first.

HTH,
Bernie
MS Excel MVP


"Coolboy55" wrote in message
...

This is my code:

-Sheet4.Range("A3", Cells(l_LastRow, l_LastColumn)).Select-

I get the error message: "Method 'Range' of object '_Worksheet'
failed"

It's a runtime error 1004.

I get this error whenever the active sheet is any sheet besides
Sheet4, and using Worksheets("SheetName") in place of Sheet4 doesn't
work either, instead getting an "Application-defined or object-defined
error."

What's going on?


--
Coolboy55
------------------------------------------------------------------------
Coolboy55's Profile: http://www.excelforum.com/member.php...o&userid=26508
View this thread: http://www.excelforum.com/showthread...hreadid=397878