Forum Discussion
AdityaMahajan
May 11, 2020Copper Contributor
run time error 1004
Hi, could anyone help me with this problem? Sub ButtonCode() Dim N As Long N = Cells(Rows.Count, "C").End(xlUp).Row + 1 Cells(N, "C").Value = (Cells(N - 1, "C").Value) * (1 - Range("Shee...
bhushan_z
May 11, 2020Iron Contributor
in which line is it failing,
can u pls help?
can u pls help?
AdityaMahajan
May 11, 2020Copper Contributor
Cells(N, "C").Value = (Cells(N - 1, "C").Value) * (1 - Range("Sheet2!E5").Value)
this and subsequent similar lines are the cause of error
- bhushan_zMay 11, 2020Iron Contributor
AdityaMahajan ur code seems fine, I am able to run it in my system.
Is it possible for u to share the file?
and I hope u have not renamed the worksheet "sheet2"? - mtarlerMay 11, 2020Silver Contributor
AdityaMahajan I think range needs an object to apply to. for example Activesheet.range(...
but it would be good practice to define an object for both cells and range to apply to and for referring to a different sheet you can activeworkbook.sheets("Sheet2").range(...