Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Macro Not working in Shared workbook

I have following vba code in excelworksheet. but i am getting run time error
1004 - method unprotect of object '_worksheet' failed while using it. Please
advise how i will be able to run these codes in shared workbook.



Private Sub btn_start_click()
mystartrow = 11
Do While Sheet1.Cells(mystartrow, 5).Value < ""
If mystartrow = 35 Then
Exit Sub
End If

If Sheet1.Cells(mystartrow, 5).Value < "" Then
mystartrow = mystartrow + 1
End If
Loop
Sheet1.Unprotect "protection"
Sheet1.Cells(mystartrow, 5) = (Now())
btn_start.Enabled = False
btn_end.Enabled = True
Sheet1.Protect "protection"
End Sub
Private Sub btn_end_click()
myendrow = 11
Do While Sheet1.Cells(myendrow, 6).Value < ""
If myendrow = 35 Then
Exit Sub
End If

If Sheet1.Cells(myendrow, 6).Value < "" Then
myendrow = myendrow + 1
End If
Loop
Sheet1.Unprotect "protection"
Sheet1.Cells(myendrow, 6) = (Now())
btn_end.Enabled = False
btn_start.Enabled = True
Sheet1.Protect "protection"
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
Shared workbook-header not working Mary jane Excel Discussion (Misc queries) 4 February 9th 10 07:17 PM
Some macros not working on shared workbook KevHardy Excel Discussion (Misc queries) 8 February 8th 10 07:39 AM
Macro Not working in Shared workbook Roger Govier[_3_] Excel Programming 0 June 14th 09 10:51 AM
VBA Code not working on Shared Workbook KC_Cheer_Coach Excel Worksheet Functions 3 April 7th 09 06:09 PM
Shared Workbook not working jazztpt Excel Discussion (Misc queries) 0 May 27th 07 12:24 PM


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

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

About Us

"It's about Microsoft Excel"