Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default How to automate with macro multiworksheet File using array variable?

I created a file with multiple Worksheets and defined an Array:

Dim arrRtTab(1 To 12) As String

arrRtTab(1) = "MS"
arrRtTab(2) = "MW"
arrRtTab(3) = "MM"
arrRtTab(4) = "MU"
arrRtTab(5) = "MDS3"
arrRtTab(6) = "XS"
arrRtTab(7) = "XN"
arrRtTab(8) = "QN"
arrRtTab(9) = "QE"
arrRtTab(10) = "QS"
arrRtTab(11) = "NS"
arrRtTab(12) = "LI"

How can I access tabs of the file as variables for copy and paste
operation in my macro?
I need to copy from tab "LI" to tab"MS" or another tab pending results
of other computations.

Georgee

  #2   Report Post  
Posted to microsoft.public.excel.programming
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default How to automate with macro multiworksheet File using array variabl

where x and y are your source and destination ranges, you should be able to do:

Worksheets(arrRtTab(12)).Range(x).Copy Worksheets(arrRtTab(1)).Range(y)

" wrote:

I created a file with multiple Worksheets and defined an Array:

Dim arrRtTab(1 To 12) As String

arrRtTab(1) = "MS"
arrRtTab(2) = "MW"
arrRtTab(3) = "MM"
arrRtTab(4) = "MU"
arrRtTab(5) = "MDS3"
arrRtTab(6) = "XS"
arrRtTab(7) = "XN"
arrRtTab(8) = "QN"
arrRtTab(9) = "QE"
arrRtTab(10) = "QS"
arrRtTab(11) = "NS"
arrRtTab(12) = "LI"

How can I access tabs of the file as variables for copy and paste
operation in my macro?
I need to copy from tab "LI" to tab"MS" or another tab pending results
of other computations.

Georgee


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default How to automate with macro multiworksheet File using array variabl

Thanks for your advice, it works nice but I have one more task.
How to select multiple tabs based on a certain condition for common
formatting tasks.
Syntax:
Worksheets(arrRtTab(1,2,3,4,5)).Select
Selection.Columns.AutoFit
ActiveWindow.Zoom = 75

Does not work

Georgee


JMB wrote:
where x and y are your source and destination ranges, you should be able to do:

Worksheets(arrRtTab(12)).Range(x).Copy Worksheets(arrRtTab(1)).Range(y)

" wrote:

I created a file with multiple Worksheets and defined an Array:

Dim arrRtTab(1 To 12) As String

arrRtTab(1) = "MS"
arrRtTab(2) = "MW"
arrRtTab(3) = "MM"
arrRtTab(4) = "MU"
arrRtTab(5) = "MDS3"
arrRtTab(6) = "XS"
arrRtTab(7) = "XN"
arrRtTab(8) = "QN"
arrRtTab(9) = "QE"
arrRtTab(10) = "QS"
arrRtTab(11) = "NS"
arrRtTab(12) = "LI"

How can I access tabs of the file as variables for copy and paste
operation in my macro?
I need to copy from tab "LI" to tab"MS" or another tab pending results
of other computations.

Georgee



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
how to automate excel file sending by outlook from within the file Adrian Excel Discussion (Misc queries) 1 September 12th 08 01:59 PM
Would Like to Automate Batch File Creation and Text FIle Import socrtwo Excel Discussion (Misc queries) 2 August 18th 06 03:54 PM
open file (as variable) from macro d chaps Excel Discussion (Misc queries) 1 March 14th 05 11:57 PM
Problem trying to us a range variable as an array variable TBA[_2_] Excel Programming 4 September 27th 03 02:56 PM
Automate open file, update links, run macro, close and save file Geoff[_7_] Excel Programming 2 August 26th 03 10:13 PM


All times are GMT +1. The time now is 06:10 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"