• 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.

Need VBA code to select Range with Real values only

mandarp22

Member
Hi All
I have data in “column D” in my work sheet, which is derived by formula and now I want to select a range of cells with VBA code in “column D” after the cell “D1” of the worksheet till the last row with the Real Value ignoring the cells with formula result “Blank” below the last Real value

Thanks
Mandar
 
Attached file has 2 ways of doing it. First way used is the Named Range method for the dropdown list. Second way was VBA
 

Attachments

  • sample file.xlsm
    23.3 KB · Views: 2
Hi Chirayu thanks for the help

I found this code below that works great for me. Only problem is I want to run this code on Sheet2 from commend button on Sheet1…..


Private Sub CommandButton1_Click()

Dim rng1 As Range

Dim rng2 As Range

Dim rng3 As Range

Set rng1 = Cells.Find("*", [a1], xlValues, , xlByRows, xlPrevious)

Set rng2 = Cells.Find("*", [a1], xlValues, , xlByColumns, xlPrevious)

Set rng3 = Range([d2], Cells(rng1.Row, rng2.Column))

Application.Goto rng3

Selection.Copy

End Sub


could you please modify the code accordingly and help me. I am new to VBA

Mandar
 
Back
Top