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 cowski 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
Joined
Dec 18, 2003
Messages
8
Location
CA
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"?
 
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

Back
Top