Run time error 424

dracula

New Member
Joined
Feb 14, 2014
Messages
1
I have a very basic code to copy "non-blank" data from one sheet and paste to another. The code is not complete yet - I am running in debug mode I get the above error. My code is as below.

Sub SampleFind()
Dim StrWord As String
Dim Quantity As String
Dim i As Long

Call nrows

For j = 2 To 2
For i = 2 To nrows1

StrWord = Sheets("Sheet6").Cells(i, 1).Value
Quantity = Sheets("Sheet6").Cells(i, j).Value

If (Quantity = "") Then
Else
Cells(i, 1).Value.Copy Destination:=Sheets("Sheet8").Cells(i, j) - I get the error when debugging at this location
End If


Next i
Next j
End sub
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Have you tried

Rich (BB code):
Sheets("SheetX").Cells(i, 1).Copy Sheets("Sheet8").Cells(i, j)
 
Upvote 0
Have you tried

Rich (BB code):
Sheets("SheetX").Cells(i, 1).Copy Sheets("Sheet8").Cells(i, j)

Your code will work but the highlighted portion is a bit misleading. The Value part was the problem:
Rich (BB code):
Cells(i, 1).Value.Copy Destination:=Sheets("Sheet8").Cells(i, j)

 
Upvote 0
Your code will work but the highlighted portion is a bit misleading. The Value part was the problem:

Apologies for that. If that sheet isn't the active worksheet, then he would be copying the from the wrong sheet/cell, hence my adding the sheet name so the code picks up the correct cell.
 
Upvote 0
Apologies for that. If that sheet isn't the active worksheet, then he would be copying the from the wrong sheet/cell, hence my adding the sheet name so the code picks up the correct cell.
No problem! That makes sense. The red text just made it seem like that was the solution to the run time error.
 
Upvote 0

Forum statistics

Threads
1,223,157
Messages
6,170,420
Members
452,325
Latest member
BlahQz

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