Copy total

User avatar
adam
SilverLounger
Posts: 2347
Joined: 23 Feb 2010, 12:07

Copy total

Post by adam »

HI anyone!

The following code inserts a blank row and copies the text "Total" below the empty row. How could I make the code to insert a row and copy the text total to that row instead of inserting a blank row.

Code: Select all

Private Sub Worksheet_Change(ByVal Target As Range)
    r = Target.Row
    c = Target.Column
    If c <> 1 Then Exit Sub
    Application.EnableEvents = False
    NextLineValue = Cells(r + 1, c)
    If NextLineValue = "Total" Then
        Rows(r + 1).Insert
    End If
    Application.EnableEvents = True
     
End Sub
Any help on this would be kindly appreciated.
Best Regards,
Adam

User avatar
agibsonsw
SilverLounger
Posts: 2403
Joined: 05 Feb 2010, 22:21
Location: London ENGLAND

Re: Copy total

Post by agibsonsw »

How could I make the code to insert a row and copy the text total to that row instead of inserting a blank row.
I don't quite follow?
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.

User avatar
adam
SilverLounger
Posts: 2347
Joined: 23 Feb 2010, 12:07

Re: Copy total

Post by adam »

Thanks for the reply agibsonsw . Attached please find the workbook of interest.

I want the text Total to be placed in the column B and the formula to be placed in row R. And the formula to count only the visible rows.
I hope I've made my question clear.

Any help on this would be kindly appreciated.

Thanks in advance.
You do not have the required permissions to view the files attached to this post.
Best Regards,
Adam