PDA

View Full Version : Amend code -



keilah
09-26-2007, 11:52 PM
Hi this code was amend and updated and provided by XLD.......works a treat just need to know how to amend it so that it proforms the same function - BUT this time changes the date field in column 8 (H) as opposed to B......

Some guidance for the Beginner..... Here is the code...

Sub MyMacro()
Dim cell As String

cell = InputBox("Enter the very last row + 1 i.e (B37 + 1 = B38)")
With Range(cell)
.EntireRow.Insert Shift:=xlDown
.RowHeight = 12.75
.RowHeight = 5
.Offset(-2, 0).EntireRow.Copy
.Offset(-1, 0).EntireRow.PasteSpecial Paste:=xlPasteFormulas, _
Operation:=xlNone, _
SkipBlanks:=False, _
Transpose:=False
.Offset(-1, 0).Value = DateSerial( _
Year(.Offset(-2, 0).Value), Month(.Offset(-2, 0).Value) + 1, Day(.Offset(-2, 0).Value))
End With
End Sub

thanks

Bob Phillips
09-27-2007, 12:25 AM
The user would just specify H8 instead of B8 for example.

You could change the text of the inputbox to tell them, but that is all that is needed.

keilah
09-27-2007, 12:27 AM
Ok that simple..........thanks.......i wasn't sure about that that the user would specify the input box...

Bob Phillips
09-27-2007, 12:32 AM
Pre-load it with H and then they onnly have to give the row ... OR

Only ask for the row and assume H ... AND

chcek it before continuing