-
Hi Larry, and welcome to VBAX.
This is worksheet code - copy and paste it in the code module for the relevant worksheet
[VBA] Option Explicit
'
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'
Dim Cell As Range
'**************************
'put your own last column below
Const LastCol As String = "$K"
'**************************
'
'//if reached the last entry in this row
If Left(Target.Address, 2) = LastCol Then
'
'//insert a new row
Rows(Target.Row + 1).Insert Shift:=xlDown
'
'//copy the row
Rows(Target.Row).Copy
'
'//paste the formats in the new row
Rows(Target.Row + 1).PasteSpecial xlPasteFormats
'
'//copy the formulas to the new row
For Each Cell In Range("B" & Target.Row, LastCol & Target.Row)
If Cell.HasFormula Then Cell.Offset(1, 0) = Cell.FormulaR1C1
Next
'
'//select column B in the new row for next entry
Intersect(Target.EntireRow, Columns(2)).Offset(1, 0).Select
End If
'
End Sub[/VBA]
You know you're really in trouble when the light at the end of the tunnel turns out to be the headlight of a train hurtling towards you
The major part of getting the right answer lies in asking the right question...
Made your code more readable, use VBA tags (this automatically inserts [vba] at the start of your code, and [/vba ] at the end of your code) | Help those helping you by marking your thread solved when it is.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules