Help with selecting all cells and Error 1004

S

Scott

Hello,

I am having problems selecting all the cells of a worksheet. I am
getting Error 1004.

I have two workbooks. Workbook1 is where the VBA code is running. I
want to select all the cells of the first sheet of Workbook2. After
opening Workbook2, I make it invisible.

In the vba code I call a subroutine and pass it Workbook2.

The following code causes error 1004:

dim ws as worksheet

set ws = workbook2.sheets(1)
ws.activate
ws.Cells.Select ***Error happens here

Any help would be greatly appreciated. I am activating the worksheet
in Workbook2 and then trying to select the cells. Does anyone know
why I am getting the error?

Any help would be greatly appreciated. I am totally stuck here.

Thanks,
Scott
 
D

Doug Robbins - Word MVP

I suggest that you post your question to the
microsoft.public.excel.programming newsgroup.

The one to which you have posted it deals with the use of visual basic in
Word.

However, the command

ws.Cells.Select ***Error happens here

should be something like

ws.Range("A1:B2").Select


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top