Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Luke
 
Posts: n/a
Default Macro for hiding rows

I have a spreadsheet which contains a lot of rows with no data, I would like
to create a macro to hide these rows.

Preferably I would like it to work off one column and hide any rows with a
value of zero.

Any ideas?
  #2   Report Post  
Posted to microsoft.public.excel.misc
Stefi
 
Posts: n/a
Default Macro for hiding rows

I think, that no macro is necessary to to this job! Simply apply an
Autofilter and choose Not empty when clicking the drop-down arrow!

Regards,
Stefi


€˛Luke€¯ ezt Ć*rta:

I have a spreadsheet which contains a lot of rows with no data, I would like
to create a macro to hide these rows.

Preferably I would like it to work off one column and hide any rows with a
value of zero.

Any ideas?

  #3   Report Post  
Posted to microsoft.public.excel.misc
PedroPastre
 
Posts: n/a
Default Macro for hiding rows

Luke,

try this VBA code: (this code consider the name of the sheet as Sheet1 and
you want to hide the rows that the cell in the column A is empty)

Sub HideEmptyRows()

With Worksheets("Sheet1")

lastrow = .Range("A65536").End(xlUp).Row

For i = 1 To lastrow

If .Range("A" & i).Value = "" Then

Rows(i & ":" & i).EntireRow.Hidden = True

End If

Next i

End With

End Sub

i hope this can help you!

Have a nice Christmas end a great New Year!

Pedro

"Luke" wrote:

I have a spreadsheet which contains a lot of rows with no data, I would like
to create a macro to hide these rows.

Preferably I would like it to work off one column and hide any rows with a
value of zero.

Any ideas?

  #4   Report Post  
Posted to microsoft.public.excel.misc
KL
 
Posts: n/a
Default Macro for hiding rows

another way without macros:

1) select one of the columns where empty cells correspond to empty rows
2) menu EditGoto...
3) press the button 'Special...'
4) mark the 'Blanks' option and press 'OK'
5) menu FormatRowsHide...

or using short cut keys:

1) having the cursor in a cell of the relevant column press Ctrl+Space
2) Ctrl+g
3) Hold Alt+ s, k,
4) Enter
5) Hold Alt + o, r, h

Regards,
KL


"Luke" wrote in message ...
I have a spreadsheet which contains a lot of rows with no data, I would like
to create a macro to hide these rows.

Preferably I would like it to work off one column and hide any rows with a
value of zero.

Any ideas?

  #5   Report Post  
Posted to microsoft.public.excel.misc
gandhi318
 
Posts: n/a
Default Macro for hiding rows


it is looking easy to hide blank cell rows rather containing zero value
while i exercise on your point you may try the following for hiding the
blank cell rows
Ctrl+G (Go To Command) or Edit I Go To I
Select Special
Select Blank
Enter or Click OK
The above process/commands selects all bank cells. Then
Format I Row I Hide


--
gandhi318Posted from - http://www.officehelp.in



  #6   Report Post  
Posted to microsoft.public.excel.misc
Norman Jones
 
Posts: n/a
Default Macro for hiding rows

Hi Luke,

As an alternative, try:

Try:

'=============
Public Sub Tester()

On Error Resume Next
Columns(2).SpecialCells(xlCellTypeBlanks).EntireRo w.Delete
On Error GoTo 0

End Sub
'<<=============


---
Regards,
Norman


"Luke" wrote in message
...
I have a spreadsheet which contains a lot of rows with no data, I would
like
to create a macro to hide these rows.

Preferably I would like it to work off one column and hide any rows with a
value of zero.

Any ideas?



  #7   Report Post  
Posted to microsoft.public.excel.misc
Norman Jones
 
Posts: n/a
Default Macro for hiding rows

Hi Luke:

Columns(2).SpecialCells(xlCellTypeBlanks).EntireRo w.Delete


Was intended to read::

Columns(1).SpecialCells(xlCellTypeBlanks).EntireRo w.Delete

---
Regards,
Norman


"Norman Jones" wrote in message
...
Hi Luke,

As an alternative, try:

Try:

'=============
Public Sub Tester()

On Error Resume Next
Columns(2).SpecialCells(xlCellTypeBlanks).EntireRo w.Delete
On Error GoTo 0

End Sub
'<<=============


---
Regards,
Norman


"Luke" wrote in message
...
I have a spreadsheet which contains a lot of rows with no data, I would
like
to create a macro to hide these rows.

Preferably I would like it to work off one column and hide any rows with
a
value of zero.

Any ideas?





  #8   Report Post  
Posted to microsoft.public.excel.misc
gandhi318
 
Posts: n/a
Default Macro for hiding rows


Sir
your suggested micro is not working
please check yourself and see a revised one is suggested
you may see my reply which hides emptry cell rows









PedroPastre Wrote:
Luke,

try this VBA code: (this code consider the name of the sheet as Sheet1
and
you want to hide the rows that the cell in the column A is empty)

Sub HideEmptyRows()

With Worksheets("Sheet1")

lastrow = .Range("A65536").End(xlUp).Row

For i = 1 To lastrow

If .Range("A" & i).Value = "" Then

Rows(i & ":" & i).EntireRow.Hidden = True

End If

Next i

End With

End Sub

i hope this can help you!

Have a nice Christmas end a great New Year!

Pedro

"Luke" wrote:

I have a spreadsheet which contains a lot of rows with no data, I

would like
to create a macro to hide these rows.

Preferably I would like it to work off one column and hide any rows

with a
value of zero.

Any ideas?



--
gandhi318Posted from - http://www.officehelp.in

  #9   Report Post  
Posted to microsoft.public.excel.misc
KL
 
Posts: n/a
Default Macro for hiding rows

just to add two comments:

1) I guess the task is to hide not to delete, so probably:
Columns(2).SpecialCells(xlCellTypeBlanks).EntireRo w.Hidden=True

2) This method has a limitation of max 8,192 non-contiguous cells (otherwise it includes the whole column/row/sheet):
http://support.microsoft.com/kb/832293/en-us For this to become an issue in this specific example one needs to have at least 16385
rows where every other row is blank (so the risk might be remote).

Regards,
KL


"Norman Jones" wrote in message ...
Hi Luke,

As an alternative, try:

Try:

'=============
Public Sub Tester()

On Error Resume Next
Columns(2).SpecialCells(xlCellTypeBlanks).EntireRo w.Delete
On Error GoTo 0

End Sub
'<<=============


---
Regards,
Norman


"Luke" wrote in message ...
I have a spreadsheet which contains a lot of rows with no data, I would like
to create a macro to hide these rows.

Preferably I would like it to work off one column and hide any rows with a
value of zero.

Any ideas?




  #10   Report Post  
Posted to microsoft.public.excel.misc
KL
 
Posts: n/a
Default Macro for hiding rows

Hi,

your suggested micro is not working


What do you mean it "is not working"? Can you please be more specific? It does to me, only it is slow, blinking and may need some
optimization. Perhaps:

Sub HideEmptyRows()
Application.ScreenUpdating=False
With Worksheets("Sheet1")
lastrow = .Range("A65536").End(xlUp).Row
For i = 1 To lastrow
If .Range("A" & i).Value = "" Then
Rows(i ).EntireRow.Hidden = True
End If
Next i
End With
Application.ScreenUpdating=True
End Sub

Also if there is a significant number of rows I would use the SpecialCells one (see the the reply by Norman Jones) as it is way
faster.

please check yourself and see a revised one is suggested


You can guess...;-)

Regards,
KL



  #11   Report Post  
Posted to microsoft.public.excel.misc
Norman Jones
 
Posts: n/a
Default Macro for hiding rows

Hi K,

1) I guess the task is to hide not to delete


Thank you - yes I mis-read!

so probably:
Columns(2).SpecialCells(xlCellTypeBlanks).EntireRo w.Hidden=True


With the qualification of my follow-up post that columns(2) should read
Columns(1), for obvious reasons.

2) This method has a limitation of max 8,192 non-contiguous cells


I am aware of the problem and have frequently referred to this in other
posts.

It should be noted, however, that the constraining factor is independent of
the number of blank cells. To demonstrate this try:

'=============
Public Sub Demo()
Dim i As Long
Dim rng As Range, rng1 As Range

Application.ScreenUpdating = False

Set rng = Range("A1").Resize(8192 * 3 - 2)

rng.Value = "XYZ"

For i = 1 To rng.Count Step 3
Cells(i, 1).Resize(2).Clear
Next i

Set rng1 = rng.SpecialCells(xlCellTypeBlanks)

rng1.Interior.ColorIndex = 6

Debug.Print "rng1.Cells.Count ", rng1.Cells.Count
Debug.Print "rng1.Areas.Count ", rng1.Areas.Count

Application.ScreenUpdating = True

End Sub
'<<=============


---
Regards,
Norman



"KL" wrote in message
...
just to add two comments:

1) I guess the task is to hide not to delete, so probably:
Columns(2).SpecialCells(xlCellTypeBlanks).EntireRo w.Hidden=True

2) This method has a limitation of max 8,192 non-contiguous cells
(otherwise it includes the whole column/row/sheet):
http://support.microsoft.com/kb/832293/en-us For this to become an issue
in this specific example one needs to have at least 16385 rows where every
other row is blank (so the risk might be remote).

Regards,
KL


"Norman Jones" wrote in message
...
Hi Luke,

As an alternative, try:

Try:

'=============
Public Sub Tester()

On Error Resume Next
Columns(2).SpecialCells(xlCellTypeBlanks).EntireRo w.Delete
On Error GoTo 0

End Sub
'<<=============


---
Regards,
Norman


"Luke" wrote in message
...
I have a spreadsheet which contains a lot of rows with no data, I would
like
to create a macro to hide these rows.

Preferably I would like it to work off one column and hide any rows with
a
value of zero.

Any ideas?






  #12   Report Post  
Posted to microsoft.public.excel.misc
JMay
 
Posts: n/a
Default Macro for hiding rows

Let's back up here.
If a cell has a 0 (zero) in it, it is not blank.

It looks like all or most of the suggestions offered here
has been if cells are Blank. But, I see that you "prefer"
if rows are 0 (zero value).

Before running this macro select (highlight) your intended range, say G2:G1000
<< Using Selection make the macro a bit more useful.

In a standard module put:

Sub HideRowsWithZero
For Each c In Selection
If c.Value = 0 Then
c.EntireRow.Hidden = True
End If
Next c
End Sub


Hope that Helps,








"KL" wrote in message
...
another way without macros:

1) select one of the columns where empty cells correspond to empty rows
2) menu EditGoto... 3) press the button 'Special...'
4) mark the 'Blanks' option and press 'OK'
5) menu FormatRowsHide...

or using short cut keys:

1) having the cursor in a cell of the relevant column press Ctrl+Space
2) Ctrl+g
3) Hold Alt+ s, k, 4) Enter
5) Hold Alt + o, r, h

Regards,
KL


"Luke" wrote in message
...
I have a spreadsheet which contains a lot of rows with no data, I would like
to create a macro to hide these rows.

Preferably I would like it to work off one column and hide any rows with a
value of zero.

Any ideas?



  #13   Report Post  
Posted to microsoft.public.excel.misc
Norman Jones
 
Posts: n/a
Default Macro for hiding rows

Hi Jim,

It looks like all or most of the suggestions offered here
has been if cells are Blank. But, I see that you "prefer"
if rows are 0 (zero value).


Granted that there is potential ambiguity, my response was predicated on the
OP's statement:

I have a spreadsheet which contains a lot of rows with no data.


Which interpretation is correct can only be resolved by the OP, but at least
he now has solutions to deal with either eventuality.

---
Regards,
Norman



"JMay" wrote in message
news:oVSqf.84061$WH.53867@dukeread01...
Let's back up here.
If a cell has a 0 (zero) in it, it is not blank.


Before running this macro select (highlight) your intended range, say
G2:G1000 << Using Selection make the macro a bit more useful.

In a standard module put:

Sub HideRowsWithZero
For Each c In Selection
If c.Value = 0 Then
c.EntireRow.Hidden = True
End If
Next c
End Sub


Hope that Helps,








"KL" wrote in message
...
another way without macros:

1) select one of the columns where empty cells correspond to empty rows
2) menu EditGoto... 3) press the button 'Special...'
4) mark the 'Blanks' option and press 'OK'
5) menu FormatRowsHide...

or using short cut keys:

1) having the cursor in a cell of the relevant column press Ctrl+Space
2) Ctrl+g
3) Hold Alt+ s, k, 4) Enter
5) Hold Alt + o, r, h

Regards,
KL


"Luke" wrote in message
...
I have a spreadsheet which contains a lot of rows with no data, I would
like to create a macro to hide these rows.

Preferably I would like it to work off one column and hide any rows with
a value of zero.

Any ideas?





  #14   Report Post  
Posted to microsoft.public.excel.misc
KL
 
Posts: n/a
Default Macro for hiding rows

Hi Norman,

It should be noted, however, that the constraining factor is independent of the number of blank cells. To demonstrate this try:


Oh yes it is, but not only of the number of blank cells but the way they are distributed. As I said in my previous message "for this
to become an issue in this specific example one needs to have at least 16385 rows where every other row is blank..." In other words
there need to be more than 8192 areas. Your code returns exactly 8192 areas, so try this one (and if you still believe that it is
independent of the # of blank cells, try reproducing the problem with <=8192 blank cells):

Public Sub Demo()
Dim i As Long
Dim rng As Range, rng1 As Range

Application.ScreenUpdating = False
Set rng = Range("A1").Resize(8192 * 3 - 1)
rng.Value = "XYZ"
For i = 1 To rng.Count Step 3
Cells(i, 1).Resize(2).Clear
Next i
Set rng1 = rng.SpecialCells(xlCellTypeBlanks)
MsgBox rng1.Areas.Count
Application.ScreenUpdating = True
Exit Sub
End Sub

Regards,
KL

  #15   Report Post  
Posted to microsoft.public.excel.misc
Norman Jones
 
Posts: n/a
Default Macro for hiding rows

Hi K,

I suspect that you misunderstand both my statement and the purpose of my
post, which had no polemical intent,.

I am well aware of the distinction between areas and cells and the relevance
of these to the use of the SpecialCells method. As I indicated, I have
referred to this precise issue in numerous previous posts,

My response, which was primarily aimed at the OP, was intended to indicate
that the number of blank cells was not a limiting issue.

I was concerned that your use of the expression:

This method has a limitation of max 8,192 non-contiguous cells


without any reference to areas or ranges might be interpreted as indicating
a limit to the number of blank cells.

This concern was not alleviated by your subsequent statement:

For this to become an issue in this specific example one needs to have at
least 16385 rows where every other row is blank (so the risk might be
remote).


which, as it implicitly refers to 8192 blank cells, might, I felt, serve to
reinforce any misconception.

I therefore provided an example of a viable use of the SpecialCells method
in which the range of interest comprised over 16k blank cells. Obviously,
the example could readily be adapted to produce analogous results with much
higher numbers of blank cells. The question of the number of areas was not
an issue: indeed the only reference to areas and, implicitly, their
relevance, was in my post. It was, as I have indicated, this contextual
omission which prompted my response.


---
Regards,
Norman


"KL" wrote in message
...
Hi Norman,

It should be noted, however, that the constraining factor is independent
of the number of blank cells. To demonstrate this try:


Oh yes it is, but not only of the number of blank cells but the way they
are distributed. As I said in my previous message "for this to become an
issue in this specific example one needs to have at least 16385 rows where
every other row is blank..." In other words there need to be more than
8192 areas. Your code returns exactly 8192 areas, so try this one (and if
you still believe that it is independent of the # of blank cells, try
reproducing the problem with <=8192 blank cells):

Public Sub Demo()
Dim i As Long
Dim rng As Range, rng1 As Range

Application.ScreenUpdating = False
Set rng = Range("A1").Resize(8192 * 3 - 1)
rng.Value = "XYZ"
For i = 1 To rng.Count Step 3
Cells(i, 1).Resize(2).Clear
Next i
Set rng1 = rng.SpecialCells(xlCellTypeBlanks)
MsgBox rng1.Areas.Count
Application.ScreenUpdating = True
Exit Sub
End Sub

Regards,
KL





  #16   Report Post  
Posted to microsoft.public.excel.misc
KL
 
Posts: n/a
Default Macro for hiding rows

OK let's attribute this to my poor command of English, but just for clarity "This method has a limitation of max 8,192
non-contiguous cells" is not mine but rather Microsoft's :-) English isn't my native language, so I am sure you can explain to me
how can "8,192 non-contiguous cells" mean anything different to "8,192 areas" in Excel.

Best regards and Merry X-Mas
KL


"Norman Jones" wrote in message ...
Hi K,

I suspect that you misunderstand both my statement and the purpose of my post, which had no polemical intent,.

I am well aware of the distinction between areas and cells and the relevance of these to the use of the SpecialCells method. As I
indicated, I have referred to this precise issue in numerous previous posts,

My response, which was primarily aimed at the OP, was intended to indicate that the number of blank cells was not a limiting
issue.

I was concerned that your use of the expression:

This method has a limitation of max 8,192 non-contiguous cells


without any reference to areas or ranges might be interpreted as indicating a limit to the number of blank cells.

This concern was not alleviated by your subsequent statement:

For this to become an issue in this specific example one needs to have at least 16385 rows where every other row is blank (so
the risk might be remote).


which, as it implicitly refers to 8192 blank cells, might, I felt, serve to reinforce any misconception.

I therefore provided an example of a viable use of the SpecialCells method in which the range of interest comprised over 16k blank
cells. Obviously, the example could readily be adapted to produce analogous results with much higher numbers of blank cells. The
question of the number of areas was not an issue: indeed the only reference to areas and, implicitly, their relevance, was in my
post. It was, as I have indicated, this contextual omission which prompted my response.


---
Regards,
Norman


"KL" wrote in message ...
Hi Norman,

It should be noted, however, that the constraining factor is independent of the number of blank cells. To demonstrate this try:


Oh yes it is, but not only of the number of blank cells but the way they are distributed. As I said in my previous message "for
this to become an issue in this specific example one needs to have at least 16385 rows where every other row is blank..." In
other words there need to be more than 8192 areas. Your code returns exactly 8192 areas, so try this one (and if you still
believe that it is independent of the # of blank cells, try reproducing the problem with <=8192 blank cells):

Public Sub Demo()
Dim i As Long
Dim rng As Range, rng1 As Range

Application.ScreenUpdating = False
Set rng = Range("A1").Resize(8192 * 3 - 1)
rng.Value = "XYZ"
For i = 1 To rng.Count Step 3
Cells(i, 1).Resize(2).Clear
Next i
Set rng1 = rng.SpecialCells(xlCellTypeBlanks)
MsgBox rng1.Areas.Count
Application.ScreenUpdating = True
Exit Sub
End Sub

Regards,
KL




  #17   Report Post  
Posted to microsoft.public.excel.misc
Norman Jones
 
Posts: n/a
Default Macro for hiding rows

Hi KL,

My interest was not a matter of semantics but uniquely the question of
possible (mis)interpretation: the mere fact that cell and area may be
interpreted differently might have some bearing.

Before leaving this matter, I note that I have omitted to respond to your
challenge:

Your code returns exactly 8192 areas, so try this one (and if you still
believe that it is independent of the # of blank cells, try reproducing
the problem with <=8192 blank cells):


Let me, therefore, rectify: try this version of the previously suggested
code:

'=============
Public Sub Demo2()
Dim i As Long
Dim rng As Range, rng1 As Range, rng2 As Range

Application.ScreenUpdating = False

Set rng = Range("A1:A16384")

rng.Value = "XYZ"

For i = 1 To rng.Rows.Count Step 2
rng.Rows(i).Clear
Next i

Set rng1 = rng.SpecialCells(xlCellTypeBlanks)
Set rng2 = rng.Columns(1).SpecialCells(xlCellTypeBlanks)

MsgBox "Rng1 Areas =" & rng1.Areas.Count _
& vbNewLine & _
"Rng2 Areas =" & rng2.Areas.Count

Application.ScreenUpdating = True

End Sub
'<<=============

---
Regards,
Norman


"KL" wrote in message
...
OK let's attribute this to my poor command of English, but just for
clarity "This method has a limitation of max 8,192 non-contiguous cells"
is not mine but rather Microsoft's :-) English isn't my native language,
so I am sure you can explain to me how can "8,192 non-contiguous cells"
mean anything different to "8,192 areas" in Excel.

Best regards and Merry X-Mas
KL


"Norman Jones" wrote in message
...
Hi K,

I suspect that you misunderstand both my statement and the purpose of my
post, which had no polemical intent,.

I am well aware of the distinction between areas and cells and the
relevance of these to the use of the SpecialCells method. As I indicated,
I have referred to this precise issue in numerous previous posts,

My response, which was primarily aimed at the OP, was intended to
indicate that the number of blank cells was not a limiting issue.

I was concerned that your use of the expression:

This method has a limitation of max 8,192 non-contiguous cells


without any reference to areas or ranges might be interpreted as
indicating a limit to the number of blank cells.

This concern was not alleviated by your subsequent statement:

For this to become an issue in this specific example one needs to have
at least 16385 rows where every other row is blank (so the risk might
be remote).


which, as it implicitly refers to 8192 blank cells, might, I felt, serve
to reinforce any misconception.

I therefore provided an example of a viable use of the SpecialCells
method in which the range of interest comprised over 16k blank cells.
Obviously, the example could readily be adapted to produce analogous
results with much higher numbers of blank cells. The question of the
number of areas was not an issue: indeed the only reference to areas and,
implicitly, their relevance, was in my post. It was, as I have indicated,
this contextual omission which prompted my response.


---
Regards,
Norman


"KL" wrote in message
...
Hi Norman,

It should be noted, however, that the constraining factor is
independent of the number of blank cells. To demonstrate this try:

Oh yes it is, but not only of the number of blank cells but the way they
are distributed. As I said in my previous message "for this to become an
issue in this specific example one needs to have at least 16385 rows
where every other row is blank..." In other words there need to be more
than 8192 areas. Your code returns exactly 8192 areas, so try this one
(and if you still believe that it is independent of the # of blank
cells, try reproducing the problem with <=8192 blank cells):

Public Sub Demo()
Dim i As Long
Dim rng As Range, rng1 As Range

Application.ScreenUpdating = False
Set rng = Range("A1").Resize(8192 * 3 - 1)
rng.Value = "XYZ"
For i = 1 To rng.Count Step 3
Cells(i, 1).Resize(2).Clear
Next i
Set rng1 = rng.SpecialCells(xlCellTypeBlanks)
MsgBox rng1.Areas.Count
Application.ScreenUpdating = True
Exit Sub
End Sub

Regards,
KL






  #18   Report Post  
Posted to microsoft.public.excel.misc
Norman Jones
 
Posts: n/a
Default Macro for hiding rows

Hi KL,

A significant typo:

Set rng = Range("A1:A16384")


should read:

Set rng = Range("A1:B16384")

---
Regards,
Norman


  #19   Report Post  
Posted to microsoft.public.excel.misc
KL
 
Posts: n/a
Default Macro for hiding rows

Norman,

It is an interesting paradox, but strictly speaking the challenge was to make SpecialCells fail with <=8192 blank cells. I think
there were 16384 blank cells in the range where SpecialCells failed. Anyway, do you know why this happens?

Thanks and regards,
KL


"Norman Jones" wrote in message ...
Hi KL,

A significant typo:

Set rng = Range("A1:A16384")


should read:

Set rng = Range("A1:B16384")

---
Regards,
Norman


  #20   Report Post  
Posted to microsoft.public.excel.misc
Norman Jones
 
Posts: n/a
Default Macro for hiding rows

Hi Kl,

It is an interesting paradox, but strictly speaking the challenge was to
make SpecialCells fail with <=8192 blank cells. I think


From the context of the thread and all preceding references, I took this to
mean non-contiguous cells! <g

As for the paradox, I noted in the past that it is possible to provoke the
solid range syndrome at points below 8192 non-contiguous areas. See, for
example:
http://tinyurl.com/8zvnd.


---
Regards,
Norman



"KL" wrote in message
...
Norman,

It is an interesting paradox, but strictly speaking the challenge was to
make SpecialCells fail with <=8192 blank cells. I think there were 16384
blank cells in the range where SpecialCells failed. Anyway, do you know
why this happens?

Thanks and regards,
KL


"Norman Jones" wrote in message
...
Hi KL,

A significant typo:

Set rng = Range("A1:A16384")


should read:

Set rng = Range("A1:B16384")

---
Regards,
Norman






  #21   Report Post  
Posted to microsoft.public.excel.misc
KL
 
Posts: n/a
Default Macro for hiding rows

Hi Norman,

As for the paradox, I noted in the past that it is possible to provoke the solid range syndrome at points below 8192
non-contiguous areas. See, for example:
http://tinyurl.com/8zvnd.


How bizarre! Have you made any progress in further research? Any hypothesis on why this happens? Also, I just thought your sample
code might run slightly faster if you avoid the looping in setting up the data:

'=============
Public Sub Demo2()
Dim x As Long, y As Long

Application.ScreenUpdating = False
Range("A2:B2").Value = "XYZ"
Range("A1:B2").AutoFill Range("A1:B16384")

x = Range("A1:B16384") _
.SpecialCells(xlCellTypeBlanks).Areas.Count
y = Range("A1:A16384"). _
SpecialCells(xlCellTypeBlanks).Areas.Count
Application.ScreenUpdating = True

MsgBox "Rng1 Areas =" & x _
& vbNewLine & _
"Rng2 Areas =" & y
End Sub
'<<=============

Thanks and regards,
KL

  #22   Report Post  
Posted to microsoft.public.excel.misc
Norman Jones
 
Posts: n/a
Default Macro for hiding rows

Hi KL,

How bizarre! Have you made any progress in further research? Any
hypothesis on why this happens?


In 'serious' code, I invariably use the segmenting ideas that emanated from
the quoted thread, so subsequent consideration has been relegated towards
the lower end of my (lengthy) 'must investigate' list. However, if I get
bored over the festive period, I will endeavour to find a reproducible
pattern.

Also, I just thought your sample code might run slightly faster if you
avoid the looping in setting up the data:


Undoubtedly, but very little thought went into the demo!

Have a happy holiday!

---
Regards,
Norman


"KL" wrote in message
...
Hi Norman,

As for the paradox, I noted in the past that it is possible to provoke
the solid range syndrome at points below 8192 non-contiguous areas. See,
for example:
http://tinyurl.com/8zvnd.


How bizarre! Have you made any progress in further research? Any
hypothesis on why this happens? Also, I just thought your sample code
might run slightly faster if you avoid the looping in setting up the data:

'=============
Public Sub Demo2()
Dim x As Long, y As Long

Application.ScreenUpdating = False
Range("A2:B2").Value = "XYZ"
Range("A1:B2").AutoFill Range("A1:B16384")

x = Range("A1:B16384") _
.SpecialCells(xlCellTypeBlanks).Areas.Count
y = Range("A1:A16384"). _
SpecialCells(xlCellTypeBlanks).Areas.Count
Application.ScreenUpdating = True

MsgBox "Rng1 Areas =" & x _
& vbNewLine & _
"Rng2 Areas =" & y
End Sub
'<<=============

Thanks and regards,
KL



  #23   Report Post  
Posted to microsoft.public.excel.misc
KL
 
Posts: n/a
Default Macro for hiding rows

Have a happy holiday!

You too!
KL
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy cell format to cell on another worksht and update automatical kevinm Excel Worksheet Functions 21 May 19th 05 11:07 AM
Macro - to copy duplicate rows to another sheet [email protected] Excel Worksheet Functions 2 April 19th 05 01:53 AM
inset rows and copy formatting , excel macro sloanranger Excel Discussion (Misc queries) 13 March 9th 05 11:44 PM
MACRO - copy rows based on value in column to another sheet Michael A Excel Discussion (Misc queries) 1 March 5th 05 02:15 AM
Adding Rows to Master Sheet Excel Newbie New Users to Excel 1 December 23rd 04 10:56 PM


All times are GMT +1. The time now is 10:16 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"