Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Selecting a column 1

Status
Not open for further replies.

Anerol

Civil/Environmental
Dec 18, 2003
8
I have a fairly simple problem, I think...

I have a sheet containing 10 different columns. In a macro, I specify it to look for a "project manager" which is the title of the column. When it finds it, I want it to select the entire column and delete it, shifting everything to the left.

The problem is that when it says range(selection, selection.end(xldown)) --- it only goes to the first blank cell, but doesn't go to the very end of the column. I know the size of my column (say 26 rows), so how do I specify it to highlight from Project manager to the 26th row, without specifying if its "A26" or "B26"?
 
Replies continue below

Recommended for you

Hello,

Do you want to select the whole column or not, if so use this

Sub select_column()
Selection.EntireColumn.Select
Range(Selection, Selection.End(xlToLeft)).Select
End Sub

However, to select rows used only try this code

Sub select_column()
Range("C1").Select
MY_CELL = ActiveCell.Column
Range(Selection, Range("A65536").Offset(0, MY_CELL - 1).End(xlUp)).Select
Range(Selection, Selection.End(xlToLeft)).Select
End Sub

Either of theses any use?



----------------------------------
Hope this helps.
----------------------------------

maybe only a drafter
but the best user at this company!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor