View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Per Jessen Per Jessen is offline
external usenet poster
 
Posts: 1,533
Default select case in vba

Hi Hein

You have to use named ranges as reference in your macro.

If you name A1:A10 as Rng1 and
name A11:A20 as Rng2, then user can insert a row, in say 10 and now Rng1
will refer to A1:A11 and Rng2 will refer to A12:A21

In your macro use this:

Range("Rng1").Hide=true

Hopes this helps.
....
Per

"Hein" skrev i meddelelsen
...
Hi

I have a select case statement that refers to various cells in different
rows from each other on a worksheet. Based on the answer that the user
provides in these cells a function will be performed whereby a specific
row
ranges will be hidden or not.

The problem that I have is that the user does have the option to insert
rows
between these cells. This will now have the effect that a code that was
linked to a specific range will now hide a different range that was
intended
as the ranges has now shifted downwards.

Is there anyway to overcome this problem?
Hein