Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > microsoft.public.excel.programming > #109467

Re: Simple array macro works on one sheet only

From isabelle <i@v.invalid>
Newsgroups microsoft.public.excel.programming
Subject Re: Simple array macro works on one sheet only
Date 2016-10-24 21:42 -0400
Organization Aioe.org NNTP Server
Message-ID <numda7$dl5$1@gioia.aioe.org> (permalink)
References <b9d8a906-baf0-4d81-90b5-3f96607b9701@googlegroups.com>

Show all headers | View raw


Hi,

  For i = LBound(MyArr) To UBound(MyArr)
     With Sheets(MyArr(i))
       .Rows("2:2").Copy .Rows("4:4")
     End With
  Next 'i

isabelle

Le 2016-10-24 à 21:11, L. Howard a écrit :
>
> This in a standard module only works on the sheet from which it is called.
>
> Should it not do all four sheets run from any sheet?
>
> Howard
>
> Sub Plain_Copy()
> Dim MyArr As Variant
> Dim i As Long
>
>
>  MyArr = Array("Sheet1", "Sheet2", "Sheet3", "Sheet4")
>
>
>  For i = LBound(MyArr) To UBound(MyArr)
>
>     Sheets(MyArr(i)).Rows("2:2").Copy Rows("4:4")
>
>  Next 'i
>
>  End Sub
>

Back to microsoft.public.excel.programming | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Simple array macro works on one sheet only "L. Howard" <lhkittle@comcast.net> - 2016-10-24 18:11 -0700
  Re: Simple array macro works on one sheet only isabelle <i@v.invalid> - 2016-10-24 21:42 -0400
    Re: Simple array macro works on one sheet only "L. Howard" <lhkittle@comcast.net> - 2016-10-24 20:51 -0700
  Re: Simple array macro works on one sheet only dienmaytrangiaabc <dienmaytrangiaabc@gmail.com> - 2016-10-26 02:43 +0100
  Re: Simple array macro works on one sheet only binhduong259 <binhduong259@gmail.com> - 2016-10-27 03:59 +0100

csiph-web