Error 438 "Object does not support this property or method

PGNewbie

New Member
Joined
Feb 6, 2020
Messages
41
Office Version
  1. 365
Platform
  1. Windows
Code:
Dim d As Range
    Dim c As Range
    Dim j As Integer
    Dim Source As Worksheet
    Dim Target As Worksheet
    Dim Condition As Worksheet
   
   
   

    Set Source = ActiveWorkbook.Worksheets("Input")
    Set Condition = ActiveWorkbook.Worksheets("Top20NoisiestDevices")
   
   
       'This will start copying data to Target sheet at row 2
   
       
      For Each d In Condition.Range("A2:A21") 'specifiy condition
     
      'create wroksheet for each value in condition
     
      Set Target = Sheets.Add(after:=ActiveSheet)
     
      Target.Name = d.Value
      j = 3
     
        'add code to show client name on line A1
        Sheets("Top20NoisiestDevices")(d.Value).Columns("E").Copy Target.Range("A1") '<--- causes the error  I'm trying to copy the value in column E that corresponds to d.value in the condition sheet
       
       
       
        Sheets("Input").Range("A1:G1").Copy Target.Range("A2")
           
     
     
            For Each c In Source.Range("E2:E6893")
           
           
       
                If Target.Name = d.Value And c.Value = d.Value Then
          
                    Source.Rows(c.Row).Copy Target.Rows(j)
                    j = j + 1
               
               End If
              
            Next c
        Next d
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
I'm afraid that code and description make no sense to me. Can you elaborate, preferably with an example, what exactly you are trying to copy? If you can post screenshots using the XL2BB tool, that would help.
 
Upvote 0
My code creates a new worksheet for each value in column A. I want Row A1 of teach new sheet to display the value of column E. I have over 20 new sheets that are being created

Capture.PNG
 
Upvote 0
Then replace this:

Code:
Sheets("Top20NoisiestDevices")(d.Value).Columns("E").Copy Target.Range("A1")

with this:

Code:
Target.Range("A1").Value = d.Offset(, 4).value
 
Upvote 0
Then replace this:

Code:
Sheets("Top20NoisiestDevices")(d.Value).Columns("E").Copy Target.Range("A1")

with this:

Code:
Target.Range("A1").Value = d.Offset(, 4).value

Wow,thank you so much for your help. This worked perfectly :) Everyone here is so amazing!
 
Upvote 0

Forum statistics

Threads
1,215,693
Messages
6,126,240
Members
449,304
Latest member
hagia_sofia

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