Hi taylork65 and welcome to ExcelForum,
It looks like all your dates are referenced to the 'current date' and probably should be stand alone.
The following will probably do what you want:
Option Explicit
Sub New_Delta()
Dim iRowAfterLastRowUsed As Long
' Go to last cell
iRowAfterLastRowUsed = Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
' Copy formula from cell above
Rows(4).Copy
Rows(iRowAfterLastRowUsed).Insert Shift:=xlDown
'Insert Today's date in Column 'G'
Cells(iRowAfterLastRowUsed, "G") = Date
End Sub
Here are a couple of tips which may help you in the future:
To prevent typos from ruining days and weeks of work 'Option Explicit' is NEEDED at the top of each code module. This prevents errors caused by missspellings and FORCES every variable to be DECLARED (e.g. dim i as Integer). http://www.cpearson.com/excel/DeclaringVariables.aspx
Debugger Secrets:
a. Press 'F8' to single step (goes into subroutines and functions).
b. Press SHIFT 'F8' to single step OVER subroutines and functions.
c. Press CTRL 'F8' to stop at the line where the cursor is.
d. 'Left Click' the margin to the left of a line to set (or clear) a BREAKPOINT.
e. Press CTRL 'G' to open the IMMEDIATE WINDOW. 'debug.print' statements send their
output to the IMMEDIATE WINDOW.
f. Select View > Locals to see all variables while debugging.
g. To automatically set a BREAKPOINT at a certain location put in the line:
'Debug.Assert False'
h. To conditionally set a BREAKPOINT at a certain location put in lines similar to:
if i >= 20 and xTV20 > 99.56 then
Debug.Assert False
endif
i. A variable value will be displayed by putting the cursor over the variable name.
----------------------------------
Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.
Posting code between [CODE] [/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.
Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here
Lewis
Bookmarks