Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select all Rows from a certain point to the end (Excel Macro)

Status
Not open for further replies.

DanAuber

IS-IT--Management
Apr 28, 2000
255
FR
I want to put some code in an Excel macro to select all rows from a certain point downwards.

The last row of my code so far is:

Range("C" & NumberofPGRows + 1).Select

This takes me to the first row I want to choose. I then want to choose all rows below (including the one I am on) right to the end of the sheet and then delete them. I'm struggling to write the (what is probably very simple) code for this.

Can anyone help ?

Thanks

 




Hi,

All kinds of ways to do this. I'd advise against using the Select method
Code:
With YourSheetObject
    with .Range(.cells(2,"C"), .cells(NumberofPGRows + 1, "C"))
       'now do stuff on this range

    end with
End With
or
Code:
With YourSheetObject
    with .Range(.cells(2,"C"), .cells(2,"C").end(xldown))
       'now do stuff on this range

    end with
End With



Skip,

[glasses]Just got a nuance...
to replace the old subtlety![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top