Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Select Cells In Column that have data
How do I select cells in column A that have any type of "Data" in them, it
can be numbers, text, or combination. Just need a macro to autoselect everything in column A that has data. Thanks Sean |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Select Cells In Column that have data
You can record it - the actions are
data menu, filter, autofilter filter on column a to Non Blanks stop the recorder - macro done! |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Select Cells In Column that have data
Hi
Range("A:A").SpecialCells(xlCellTypeConstants, xlNumbers + xlTextValues).Select Will select cells with text or numbers. If you want formulas change to xlTypeFormulas in specialcells. If you want constants and formulas, you will have to do a set statement Set ConstCells = Range("A:A").SpecialCells(xlCellTypeConstants, xlNumbers + xlTextValues) and same for FormulaCells. Then union the two ranges and select that. regards Paul |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Select Cells In Column that have data
-- --- Regards, Norman "Sean" wrote in message ... How do I select cells in column A that have any type of "Data" in them, it can be numbers, text, or combination. Just need a macro to autoselect everything in column A that has data. Thanks Sean |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Select Cells In Column that have data
Hi Sean,
How do I select cells in column A that have any type of "Data" in them, it can be numbers, text, or combination. Just need a macro to autoselect everything in column A that has data. Try: '================ Public Sub PopulatedRange() Dim WB As Workbook Dim SH As Worksheet Dim srcRng As Range Dim destRng As Range Dim RngA As Range, RngB As Range Dim popRng As Range Set WB = Workbooks("Book1.xls") '<<===== CHANGE Set SH = WB.Sheets("Sheet1") '<<===== CHANGE Set srcRng = SH.Range("A:A") '<<===== CHANGE On Error Resume Next Set RngA = srcRng.Cells. _ SpecialCells(xlCellTypeConstants) Set RngB = srcRng.Cells. _ SpecialCells(xlCellTypeFormulas) If Not RngA Is Nothing Then Set popRng = RngA If Not RngB Is Nothing Then If Not popRng Is Nothing Then Set popRng = Union(RngB, popRng) Else Set popRng = RngB End If End If popRng.Select End Sub '<<================ --- Regards, Norman |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
VBA: Column Select then Data Select then return to cell A1 | Excel Discussion (Misc queries) | |||
How do you select all text/data within all the cells of a column? | Excel Discussion (Misc queries) | |||
How to select certain cells in a column ? | Excel Discussion (Misc queries) | |||
Macro to select cells in column enter data then press enter | New Users to Excel | |||
Shortcut to select column with data in previous column | Excel Discussion (Misc queries) |