VBA Copy Row to Sheet, Keep Destination Formatting

knscha2

New Member
Joined
Oct 6, 2021
Messages
1
Office Version
  1. 2019
Platform
  1. Windows
The module successfully copies all rows from the source sheet to the destination sheet that have 'Fletcher Bone' in row B. How can I edit my code to copy the values from the source, yet keep the formatting in the destination? Any help you can provide is greatly appreciated!

VBA Code:
    Set wsSource = Sheets("Overview")
    Set wsDestin = Sheets("Fletcher")
   
    With wsSource
        Set rngSource = .Range(.Cells(10, "B"), .Cells(.Rows.Count, "B").End(xlUp))
    End With
  
    For Each rngCel In rngSource
        If rngCel.Value = "Fletcher Bone" Then
            With wsDestin
                lngDestinRow = .Cells(.Rows.Count, "B").End(xlUp).Offset(1, 0).Row
                .Cells(lngDestinRow, "B").EntireRow = rngCel.EntireRow.Value
            End With
        End If
    Next rngCel
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Hi and welcome to MrExcel.

Try this:

VBA Code:
Sub copyrange()
  With Sheets("Overview")
    .Range("B9", .Range("B" & Rows.Count).End(3)).AutoFilter 1, "Fletcher Bone"
    .AutoFilter.Range.Offset(1).EntireRow.Copy Sheets("Fletcher").Range("A" & Sheets("Fletcher").Range("B" & Rows.Count).End(3).Row + 1)
    .ShowAllData
  End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top