Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Worksheet Sharing VBA

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").ClearConten ts

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default Worksheet Sharing VBA

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---

--
RyGuy


"CROD" wrote:

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").ClearConten ts

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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Worksheet Sharing VBA


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

"ryguy7272" wrote:

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---

--
RyGuy


"CROD" wrote:

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").ClearConten ts

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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default Worksheet Sharing VBA

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--

--
RyGuy


"CROD" wrote:


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

"ryguy7272" wrote:

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---

--
RyGuy


"CROD" wrote:

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").ClearConten ts

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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sharing Worksheet Denver Excel Worksheet Functions 1 July 2nd 09 02:35 PM
Sharing data from one worksheet to another Samantha Excel Worksheet Functions 0 May 7th 09 06:35 PM
Sharing and protecting sections of a worksheet. Ekazakoff Excel Discussion (Misc queries) 1 August 9th 06 02:59 AM
Sharing worksheet with a customer toolbar Confused Excel User Excel Worksheet Functions 0 February 28th 06 07:55 PM
Sharing Worksheet cannot complete task Spirit130 Excel Worksheet Functions 0 October 6th 05 01:55 PM


All times are GMT +1. The time now is 09:04 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"