![]() |
|
|
Thread Tools | Display Modes |
#3
|
|||
|
|||
![]() Quote:
Because I want to make a first check on whether there are empty cells and send me a message and make me POSTTOREGISTER, I tried to adapt your own (I do not know if I put it at the right point) but it is a problem of drafting and finally I think that Locking the new spreadsheet does not succeed if there is any other way or is it better to save it as a pdf (I tried it but when I open it I get a message that the file is corrupted Sub PostToRegister() Dim Lrow As Long Lrow = Sheets("LIST INVOICE").Cells(Rows.Count, 1).End(xlUp).Row Dim inDate As Date, inNum As Long inDate = Sheets("INVOICE").Cells(38, 7).Value inNum = Sheets("INVOICE").Cells(5, 9).Value Dim exDate, exNum As Long exDate = Sheets("LIST INVOICE").Cells(Lrow, 1).Value exNum = Sheets("LIST INVOICE").Cells(Lrow, 2).Value If .Range("F16") = "" Or .Range("E31") = "" Or .Range("G31") = "" Or .Range("G38") = "" Then MsgBox "some stuff missing" Exit Sub End If If inDate >= exDate And inNum > exNum Then Dim WS1 As Worksheet Dim WS2 As Worksheet Set WS1 = Worksheets("INVOICE") Set WS2 = Worksheets("LIST INVOICE") 'Figure out which row is the next row NextRow = WS2.Cells(Rows.Count, 1).End(xlUp).Row + 1 'Write the important values to Register 'Write the important values to Register WS2.Cells(NextRow, 1).Resize(1, 6).Value = Array(WS1.Range("G38"), WS1.Range("I5"), WS1.Range("H5"), _ WS1.Range("F16"), WS1.Range("G31"), WS1.Range("E31")) Else MsgBox "ERROR" End End If End Sub |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
maxbeedie | Word | 1 | 11-15-2016 04:04 AM |
![]() |
zislam14 | Project | 3 | 12-17-2015 03:03 PM |
Saving sent mails to specific folder | kammil121 | Outlook | 0 | 10-22-2014 02:26 AM |
Change Cell Color Based On % Complete | jrfoley3 | Project | 1 | 05-30-2013 05:24 AM |
![]() |
bjtrain83 | Word | 1 | 01-10-2010 02:36 PM |