Results 1 to 10 of 10

Formatting of pasted row via VBA

Threaded View

  1. #1
    Registered User
    Join Date
    09-18-2008
    Location
    Devon
    MS-Off Ver
    2002
    Posts
    71

    Formatting of pasted row via VBA

    Hi all

    I have the current code:

    Sub addallrows()
    
    Dim divrow As Long
    Dim arearow As Long
    Dim notoppd As Long
    
    For divrow = Cells(Rows.Count, "E").End(xlUp).Row To 2 Step -1
        If Cells(divrow, "E") <> Cells(divrow - 1, "E") Then
            Cells(divrow, "E").EntireRow.Insert
            Cells(divrow, "A").Value = Cells(divrow + 1, "E").Value
    End If
    
    Next divrow
    
    For arearow = Cells(Rows.Count, "G").End(xlUp).Row To 3 Step -1
    If Cells(arearow, "G") <> Cells(arearow - 1, "G") Then
            Cells(arearow, "G").EntireRow.Insert
            Cells(arearow, "A").Value = Cells(arearow + 1, "G").Value
    End If
    
    Next arearow
    
    For notoppd = Cells(Rows.Count, "E").End(xlUp).Row To 3 Step -1
    If Cells(notoppd, "E") <> "Adults/Phys Dis/Older People" Then
            Cells(notoppd, "H").Value = Cells(notoppd, "F").Value
            
    End If
    
    Next notoppd
    
    Columns("E:G").Select
    Selection.Delete Shift:=xlToLeft
    Range("A2").Select
    
    End Sub
    Where rows are inserted, can I stop them from copying the formatting from the row above??

    Also, I would like the text that is pasted into the cell A (for divrow and arearow) to be left aligned and bold.

    Can someone help?
    Last edited by HelenW; 10-13-2010 at 10:23 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1