![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: May 2002
Posts: 251
|
Hi,
I want to select used area in spreed sheet. I tried to use these codes, but its selecting the numeric range plus format range too. Like for example if I have a data only from column A through D and rows 1 through 10. It should select only A through D and 1 through 10. It select that area, but if I have line or border in row 12. then it select up to row 12. I want only numeric used area to be selected, as well as letters too, not the lines and borders at the end of used area. Can you please help me with this. Thanks a lot. Sub Select_Loop() Dim rAcells As Range, rloopcells As Range rAcells.Select Set rAcells = ActiveSheet.UsedRange End Sub |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Sydney, Australia
Posts: 2,908
|
Hi,
You can use a combination of SpecialCells and Union to select only constants and formulas on your worksheet e.g. Code:
Sub test() Dim rngeUsed As Range, rngeFormulas As Range, rngeConstants As Range Set rngeUsed = ActiveSheet.UsedRange Set rngeFormulas = rngeUsed.SpecialCells(xlCellTypeFormulas) Set rngeConstants = rngeUsed.SpecialCells(xlCellTypeConstants) Application.Union(rngeFormulas, rngeConstants).Select End Sub Any questions please post, Dan |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|