0
Dim FIND_VALUE As String
Dim j As Double

FIND_VALUE = "RDD1250 Due SO not Billed"

  For j = 1 To Worksheets.Count
     If Worksheets(j).Range("C7").Value = FIND_VALUE Then
     Worksheets(j).Activate
     Range("B13", Cells(Range("B13").Row, Columns.Count).End(xlToLeft).End(xlDown)).Select
     Selection.Copy

This code is giving type error mismatch...when i try to run this code it gives proper results but giving type error mismatch when i try to run it for some other sheets.. can some one help on this as well partial search.. i tried with "*" as well but didnt get the result.

Community
  • 1
  • 1
  • 2
    It probably won't clear up the error, but you should declare `j` as `Long` rather than `Double`. It would also be good to introduce explicit worksheet variables to qualify your `Range` with, rather than relying on `Activate` – John Coleman Dec 11 '17 at 16:53
  • 2
    Where are you getting the error? Where are you pasting? Show a bit more from your code, most probably you are not pasting correctly. – Vityata Dec 11 '17 at 16:55

1 Answers1

0

Although I cannot see where your pasting the data, this should work... So I will work with what little information was given.

Sub test1()

   Dim ws As Worksheet
   Dim FIND_VALUE As String

   FIND_VALUE = "RDD1250 Due SO not Billed"

   For Each ws In ActiveWorkbook.Worksheets
      If Range("C7").Value = FIND_VALUE Then
         Range("B13", Cells(Range("B13").Row, Columns.Count).End(xlToLeft).End(xlDown)).Copy
      End If
   Next

End Sub

TIP: Try to avoid using .Select and .Activate

Please see here for more helpful tips regarding .Select and .Activate

Maldred
  • 1,074
  • 4
  • 11
  • 33