• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Paste formula till end of the data

ushaanu

Member
HI all,

I have some data in excel sheet

where I need the Macro to RUN till the end of the data and the content (formula ) in cell J column gets copied till the end of the data cell.

Sample File enclosed.


Thanks
ANu
 

Attachments

  • Sheet1.xlsx
    9.6 KB · Views: 5
Hello Anu
Try this code
Code:
Sub Test()
    With ActiveSheet
        With .Range("J2:J" & .Cells(Rows.Count, 10).End(xlUp).Row)
            .Formula = "=IF(H2=""NO"",""NO Part Reqd"",""Yes part Reqd"")"
        End With
    End With
End Sub
 
thank you but when run this code .
only one cell calculate the formula like
 

Attachments

  • Sheet1.xlsx
    9.6 KB · Views: 3
  • REQ output.xlsx
    9.7 KB · Views: 3
Change 10 in the code with a column number that already has data (say column B) so in this case 10 would become 2 ..
 
Dear Sir @MarcL,
Just Great as tageted rows defined at first. Also we can work on any column of this Dynamic range.
We can use any property or methods if we can successfully define range on which we want work.

Apply count & evaluate is also amazing.

Regards,

Chirag Raval
 
Last edited by a moderator:
Another method
Code:
Sub blah()

With Sheet1
i& = .Cells(Rows.Count, 1).End(xlUp).Row
.[J2].Resize(i - 1).Formula = "=IF(H2=""NO"",""NO Part Reqd"",""Yes part Reqd"")"
End With

Dear Sir @YasserKhalil  & @Nebu .

Effactive use of resize property. Just great.

[quote="Nebu, post: 234876, member: 17440"]Another method
[CODE]Sub blah()

With Sheet1
i& = .Cells(Rows.Count, 1).End(xlUp).Row
.[J2].Resize(i - 1).Formula = "=IF(H2=""NO"",""NO Part Reqd"",""Yes part Reqd"")"
End With

End Sub
Thanks
 
Last edited by a moderator:
Back
Top