Worksheet Sharing VBA

C

CROD

The following VBA code runs great when the Workbook is not Shared or
Protected. When I do Share The Workbook, the code takes over a minute to
copy each row of data. I am forced to cancel the run (via the ESC key) and
recieve the following message "'Run Time Error 1004': Copy Method of Range
class failed". Do I need to adjust my code to execute in a "Shared
Workbook"? If so, how? Could you please provide a solution. Thanks in
advance for your assistance! Here's the actual code:

Sub Rectangle2_Click()

CodeName = InputBox("Enter Project Code")

Worksheets("Sheet1").Select
Worksheets("Sheet1").Range("A1").Value = CodeName
Worksheets("Sheet1").Range("A8:U5000").ClearContents

RowCount = 8

With Worksheets("Sheet2").Range("A5:U5000")

Set c = .Find(Cells(3, 1))

If Not c Is Nothing Then
firstAddress = c.Address

Do
c.EntireRow.Copy _
Destination:=Worksheets("Sheet1").Rows(RowCount)

RowCount = RowCount + 1

Set c = .FindNext(c)

Loop While Not c Is Nothing And c.Address <> firstAddress

End If

End With

End Sub
 
R

ryguy7272

I've encountered similar behavior. I'm not sure what causes this, but it
tends to run extremely slow in 'shared' mode. The only thing that I've been
able to do was un-share the workbook, and then do the stuff that I needed to
do, and then re-share the file. I'd be curious to know how others handle
this issue.

Regards,
Ryan---
 
C

CROD

Any possibility in having the macro to "Unshare the Workbook", run program,
then "Re-Share the Workbook" automatically?
 
R

ryguy7272

I'm not sure you can do what you want to do. Search for 'Features that are
unavailable in shared workbooks' in Excel's help menu. You will see that
certain features are unavailable in a 'Shared' workbook. I don't know the
technical reasons for this; must be a valid reason for it though...

Regards,
Ryan--
 

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