LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default VBA error 1004 on With worksheet.Paste

I have a worksheet with data that I sometimes want to copy to 3 other worksheets rather than entering the data on each sheet individually.

I just recently protected the worksheets and am getting "error 1004", when running the macro. I added the worksheet.unprotect and protect method to account for this, but am getting the error at the ".paste" portion of the macro.

Anyone know whats causing it? Code Below:

ub mastertermscopy(ByVal wksname As String, ibox() As Integer)

Dim z As Byte

Worksheets(wksname).Unprotect Password:="xxxxxx"
Worksheets(wksname).Range("a11:h51").Copy

For z = 3 To 5

If Worksheets(z).Name = wksname Then

Else
Worksheets(z).Unprotect Password:="xxxxxx"

With Worksheets(z)
.Select
.Range("a11:h51").Select
.Paste <-------------------------debugger points to this part of code
.ComboBox1.ListIndex = ibox(0)
.ComboBox2.ListIndex = ibox(1)
.ComboBox3.ListIndex = ibox(2)
.ComboBox4.ListIndex = ibox(3)
.CheckBox1.Value = CBool(ibox(4))
.CheckBox2.Value = CBool(ibox(5))
.CheckBox3.Value = CBool(ibox(6))
.CheckBox4.Value = CBool(ibox(7))
.CheckBox5.Value = CBool(ibox(8))
.Range("m7").Select
End With

Worksheets(z).Protect Password:="xxxxxx"

End If
Next z

Worksheets(wksname).Select
Worksheets(wksname).Protect Password:="xxxxxx"


End Sub

Any help would be appreciated....AJ
 
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
Error 1004, paste method of Worksheet class failed Jim at Michoud Excel Programming 3 August 14th 09 02:30 PM
Copy paste to another Workbook, Error 1004 Steve[_87_] Excel Programming 7 April 16th 07 05:49 PM
Error 1004 Paste method of Worksheet class failed skvabbili Excel Programming 1 May 4th 06 11:03 PM
runtime error 1004 paste method of worksheet class failed wilsoj Excel Programming 12 August 10th 05 08:20 PM
Run Time error 1004 Paste Method of Worksheet Class Failed Ken Nunn Excel Programming 3 June 29th 04 03:23 PM


All times are GMT +1. The time now is 02:46 PM.

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"