![]() |
|
|
|||||||
| 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: Feb 2002
Location: England
Posts: 212
|
I'm trying to write code for moving the cell position down from A1 to the next row where the cell is unhidden, any ideas?
Thanks Matt [ This Message was edited by: Matt on 2002-03-27 07:57 ] |
|
|
|
|
|
#2 |
|
Board Regular
Join Date: Mar 2002
Location: London, UK
Posts: 167
|
Yeah, i guess your implying that the rows are hidden simply by having rowheight=0, then you could use the following...
Sub test() rowx = 2 Do Until Cells(rowx, 1).EntireRow.RowHeight > 0 rowx = rowx + 1 Loop Cells(rowx, 1).Select End Sub |
|
|
|
|
|
#3 |
|
MrExcel MVP
Join Date: Mar 2002
Location: Kobe, Japan
Posts: 1,420
|
Hi Matt.
If Use "Hidden Property" , we are able to know whether the row is hidden or not. Sub test2() Dim i As Long With Range("A1") Do i = i + 1 If .Offset(i).EntireRow.Hidden = False Then Exit Do Loop Application.Goto .Offset(i) End With End Sub Or the following method is not good (mean I do not like) but move onto the unhidden cell. Sub test3() With Application .Goto Range("A1") .SendKeys "{DOWN}", True End With End Sub |
|
|
|
|
|
#4 |
|
Banned
Join Date: Feb 2002
Posts: 1,582
|
Hi Matt
Here is a nice easy fast way Dim rRange As Range Set rRange = Range("A1", Range("A65536").End(xlUp)) _ .SpecialCells(xlCellTypeVisible) rRange.Areas(1).Cells(rRange.Areas(1).Rows.Count + 1, 1).Select |
|
|
|
|
|
#5 | |
|
New Member
Join Date: Mar 2002
Posts: 4
|
Quote:
But what if there is only one cell in the first area of rRange ? |
|
|
|
|
|
|
#6 |
|
MrExcel MVP
Join Date: Mar 2002
Location: Kobe, Japan
Posts: 1,420
|
Hi Dave. That's nice and good idea!
How about this one.
[ This Message was edited by: Colo on 2002-03-29 23:57 ] |
|
|
|
|
|
#7 |
|
Banned
Join Date: Feb 2002
Posts: 1,582
|
RE: But what if there is only one cell in the first area of rRange ?
You tell me? Far as I can tell it will make no difference. |
|
|
|
|
|
#8 | |
|
New Member
Join Date: Mar 2002
Posts: 4
|
Quote:
But ... your code selects the first cell (hidden or not) after area(1) of rRange. The original question was to select the second visible cell. |
|
|
|
|
|
|
#9 |
|
Banned
Join Date: Feb 2002
Posts: 1,582
|
I misread Matts question too, hee asked "I'm trying to write code for moving the cell position down from A1 to the next row where the cell is unhidden"
I read this as next HIDDEN cell. My original will select the next HIDDEN cell and not VISIBLE. This should work though Range("A2", Range("A65536").End(xlUp)) _ .SpecialCells(xlCellTypeVisible).Range("A1").Select |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|