Code Help needed error 1004

seenfresh

Well-known Member
Joined
Jul 12, 2006
Messages
1,141
I have the following piece of a code of which prompts an error 1004 "Unable to get the find property of the range class"

Code:
With Worksheets("Adjustments").Range("B1:B" & Rows.Count)

    
      NewRow = .Cells.Find("", .Cells(1, 2), xlFormulas, _
        xlWhole, xlByColumns, xlNext).Row
        
  ' This finds a row starting from top that is empty to put the new values in!!!
        Worksheets("Adjustments").Rows(NewRow & ":" & NewRow).Value = datai
    

  
    End With

I have used this code for other procedures, but for some reason I can't figure out this error...

Can anyone spot anything FISHY :(

Would appreciated any advice

Thanks in advance,
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Hi

Does this work:

Code:
With Worksheets("Adjustments").Range("B1:B" & Rows.Count) 

    
      NewRow = .Find("", .Cells(1, 1), xlFormulas, _ 
        xlWhole, xlByColumns, xlNext).Row 
        
  ' This finds a row starting from top that is empty to put the new values in!!! 
        Worksheets("Adjustments").Rows(NewRow & ":" & NewRow).Value = datai 
    

  
    End With
 
Upvote 0
reply

Code:
 NewRow = .Find("", .Cells(1, 1), xlFormulas, _ 
        xlWhole, xlByColumns, xlNext).Row

Thank you for your reply Richard!

I actually just added the Worksheet reference and it worked:

NewRow = Worksheets("Adjustments").Cells.Find....

I'll try your method as well since it is shorter... I'm just a bit curious that the object wasn't already acknowledged from the With statement!

Thanks again!
 
Upvote 0

Forum statistics

Threads
1,214,790
Messages
6,121,608
Members
449,038
Latest member
apwr

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