Consulting

Results 1 to 3 of 3

Thread: VBA to use Format Painter from one row to another row

  1. #1
    VBAX Contributor
    Joined
    Jun 2019
    Posts
    155
    Location

    VBA to use Format Painter from one row to another row

    After copy the data from other sheet, i want that row to be in the same format (with borders). where ever the data is updating the entire row to be same format of B12:G12 all work sheet (sheet4 to 8). can any one help me for this

  2. #2
    VBAX Mentor
    Joined
    Dec 2008
    Posts
    404
    Location
    If you use the Copy method, the range will be copied along with its formatting
    Source_Range.Copy Destination_Range
    Artik

  3. #3
    VBAX Contributor
    Joined
    Jun 2019
    Posts
    155
    Location
    I am using the following code for copy the data

    Dim aaa As String, shArr
    aaa = ActiveSheet.Name
    shArr = Array("Sheet4", "Sheet5", "Sheet6", "Sheet7", "Sheet8")    '<---- Add or remove sheet names as required.
    Application.ScreenUpdating = False
    For ii = LBound(shArr) To UBound(shArr)
        With Sheets(shArr(ii))
            Sheets("sheet4").Range("B11:G136").Value = Sheets("Data").Range("A29:F154").Value
            Sheets("sheet5").Range("B11:G36").Value = Sheets("Data").Range("A163:F188").Value
            Sheets("sheet6").Range("B11:G26").Value = Sheets("Data").Range("A197:F212").Value
            Sheets("sheet7").Range("B11:G26").Value = Sheets("Data").Range("A221:F236").Value
            Sheets("sheet8").Range("B11:G31").Value = Sheets("Data").Range("A245:F265").Value
        End With
    Next ii
    Sheets(aaa).Activate
    Application.ScreenUpdating = True

    For example :
    Mostly the datas will replace on sheet6 in the range of B20:G26. I want to update the row format(Include border) of Sheet6 B12:G12 to the newly copied rows (till B26:G26)

    Like this to be update all the sheets ("Sheet4", "Sheet5", "Sheet6", "Sheet7", "Sheet8")

    How to update my above requirement

Posting Permissions

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