Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
bbc1
 
Posts: n/a
Default Unprotect sheet when printing

Have the below code to print a sheet, increment a invoice number and remove
protection from sheet, at the moment the passowrd is nothing I nee to change
this to qwert and edit the formula to up protect sheet on print and re
protect it after the incrementing of the invoice number. Any help would be
appreaciated.

Sub dayprint()
'
' dayprint Macro
'
'

ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheet13.Unprotect
'Increment the invoice number
[e3] = [e3] + 1
Sheet13.Protect

' Save Macro
' Macro recorded 19/08/2005
'
'
ActiveWorkbook.Save
End Sub
  #2   Report Post  
Norman Jones
 
Posts: n/a
Default

Hi BBC1,

Try something like:

Sub dayprint()
Const PWORD As String = "qwert"

ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
With ThisWorkbook.Sheets("Sheet13")
.Unprotect Password:=PWORD
'Increment the invoice number
With .Range("E3")
.Value = .Value + 1
End With
.Protect Password:=PWORD
End With

ActiveWorkbook.Save
End Sub


---
Regards,
Norman



"bbc1" wrote in message
...
Have the below code to print a sheet, increment a invoice number and
remove
protection from sheet, at the moment the passowrd is nothing I nee to
change
this to qwert and edit the formula to up protect sheet on print and re
protect it after the incrementing of the invoice number. Any help would be
appreaciated.

Sub dayprint()
'
' dayprint Macro
'
'

ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheet13.Unprotect
'Increment the invoice number
[e3] = [e3] + 1
Sheet13.Protect

' Save Macro
' Macro recorded 19/08/2005
'
'
ActiveWorkbook.Save
End Sub



  #3   Report Post  
bbc1
 
Posts: n/a
Default

Thankyou works great.

"Norman Jones" wrote:

Hi BBC1,

Try something like:

Sub dayprint()
Const PWORD As String = "qwert"

ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
With ThisWorkbook.Sheets("Sheet13")
.Unprotect Password:=PWORD
'Increment the invoice number
With .Range("E3")
.Value = .Value + 1
End With
.Protect Password:=PWORD
End With

ActiveWorkbook.Save
End Sub


---
Regards,
Norman



"bbc1" wrote in message
...
Have the below code to print a sheet, increment a invoice number and
remove
protection from sheet, at the moment the passowrd is nothing I nee to
change
this to qwert and edit the formula to up protect sheet on print and re
protect it after the incrementing of the invoice number. Any help would be
appreaciated.

Sub dayprint()
'
' dayprint Macro
'
'

ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheet13.Unprotect
'Increment the invoice number
[e3] = [e3] + 1
Sheet13.Protect

' Save Macro
' Macro recorded 19/08/2005
'
'
ActiveWorkbook.Save
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
Enlarging spread sheet for printing? Keeper Excel Discussion (Misc queries) 3 February 10th 06 03:39 PM
Block an area of sheet from Printing? lbbss Excel Discussion (Misc queries) 4 June 8th 05 07:21 PM
Copy 1 Sheet to Another Dar Excel Worksheet Functions 3 June 6th 05 10:52 PM
Simple question - one xls sheet keeps printing 6 copies as default Phillip Vong Excel Discussion (Misc queries) 1 May 28th 05 10:22 AM
Subset of one sheet on another sheet bxb7668 Excel Discussion (Misc queries) 3 April 25th 05 03:55 PM


All times are GMT +1. The time now is 09:40 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"