0

I have modified and used the code from This youtube video about how to copy values to another sheet if the cell text meets a certain condition. However, I want to copy the values in the cells from "BM" Then Status.Offset(, -8).Resize(, 8).Copy PasteCell not the formulas as my cells contains formulas.

I understand that you can use PasteSpecial somehow, but I don't understand how I can use that since I'm not using Paste anywhere.

Hope somebody are able to help :)

Option Explicit

Sub BM_models()

Dim StatusCol As Range
Dim Status As Range
Dim PasteCell As Range
'STEP1: Change the sheet name and range in the line of code below to match the sheet name
'and range holding the data that you want to copy rows from.
Set StatusCol = Sheet1.Range("Q10:Q154")

For Each Status In StatusCol

'STEP2: Change the sheet name and range in the lines of code below to match the sheet name
'and cell that you want to copy your data to. You only need to specify one cell -
'the first cell you will copy to.
    If Sheet4.Range("A7") = "" Then
        Set PasteCell = Sheet4.Range("A7")
    Else
'STEP3: In the line of code below, the range should refer to your first column heading
        Set PasteCell = Sheet4.Range("A6").End(xlDown).Offset(1, 0)
    End If

    If Status = "BM" Then Status.Offset(, -8).Resize(, 8).Copy PasteCell


Next Status
        
End Sub
BigBen
  • 38,994
  • 6
  • 24
  • 37
RamyPanda
  • 21
  • 4

0 Answers0