Hi Rolf,
Sorry....
Besides being new to VBA (my first attempt at macro), my description of my requirements is also sadly lacking....
Anyway, Iwill try again. Please bear with me...
Book1(SourceFile), Book2 (LogFile) and Book3(updated Book1....as a new invoice) ----- same directory
Book1 (SourceFile)Write protected file. Opens (with password) and increments and updates cell A1 ......used as New Invoice# (Please see my original lines of code which works for incrementing invoice# and saving as a new file with new invoice#)
Important cells (example): B2, C7, D7,E7, H10


http://www.mrexcel.com/forum/member.php?u=22953


Book2 (LogFile)Write protected file and stays closed. It is essentially a log of all invoices.
Important cells: A1, B1, C1, D1, E1
next invoice
A2, B2, C2, D2, E2
and so on.....
Book3 (Filled Book1) copy .....(copy of Full Invoice)After Book1 is Updated, Its is saved as a new invoiced
Process:When Book1 is opened, it unprotects itself with a password and increments A1 indicating new Invoice# and saves itself as a new invoice(Book3) and remains open for it to be updated.
After it is updated, a button activates save(as Book3) ... new invoice....as well as an update of information on the next empty row of Book2. A prompt is displayd after to email and/or print a copythis invoice.
The two small bits of code I included originally work separately but the Log is only filled in the same workbook.
I looked at your code and I can uderstand , I think most of it, but I cant seam to get it working so I found some other code,below, written by Zack which appear to suggest should do exactly what you suggested but I cant understand what some of the code is. Perhaps you could explain it for me if you dont mind but I cant work this one either. Sorry I appear to be a little too green. My background is RF. Thanks again.
http://www.mrexcel.com/forum/member.php?u=22953: solution
Option Explicit
Sub TransferData()
Dim wkb As Workbook, wks As Worksheet, LastRow As Long
Dim FilePath As String, FileName As String
Dim ws As Worksheet, blnOpened As Boolean
'Change these variables as desired...
FilePath = "C:\YourFullFilePathHere\" 'change path here
FileName = "Book2.xls" 'change name here
Call ToggleEvents(False)
Set ws = ThisWorkbook.Sheets("Sheet1") 'change source sheet name here
If WbOpen(FileName) = True Then
Set wkb = Workbooks(FileName)
blnOpened = False
Else
If Right(FilePath, 1) <> Application.PathSeparator Then
FilePath = FilePath & Application.PathSeparator
End If
Set wkb = Workbooks.Open(FilePath & FileName)
blnOpened = True
End If
Set wks = wkb.Sheets("Sheet1") 'change destination sheet name here
LastRow = wks.Cells.Find(what:="*", after:=wks.Cells(1, 1), searchorder:=xlByRows, searchdirection:=xlPrevious).Row + 1
wks.Cells(LastRow, "A").Value = ws.Cells(1, "B").Value
wks.Cells(LastRow, "B").Value = ws.Cells(4, "B").Value
wks.Cells(LastRow, "C").Value = ws.Cells(7, "B").Value
wks.Cells(LastRow, "D").Value = ws.Cells(7, "E").Value
If blnOpened = True Then
wkb.Close SaveChanges:=True
End If
If MsgBox("Clear values?", vbYesNo, "CLEAR?") = vbYes Then
Call ClearData
End If
Call ToggleEvents(True)
End Sub
Sub ClearData()
Dim ws As Worksheet
Set ws = ThisWorkbook.Sheets("Sheet1") 'change as desired
ws.Range("B1").ClearContents 'Name
ws.Range("B4").ClearContents 'Address
ws.Range("B7").ClearContents 'Age
ws.Range("E7").ClearContents 'Sex
End Sub
Sub ToggleEvents(blnState As Boolean)
'Originally written by firefytr
With Application
.DisplayAlerts = blnState
.EnableEvents = blnState
.ScreenUpdating = blnState
If blnState Then .CutCopyMode = False
If blnState Then .StatusBar = False
End With
End Sub
Function WbOpen(wbName As String) As Boolean
'Originally found written by Jake Marx
On Error Resume Next
WbOpen = Len(Workbooks(wbName).Name)
End Function