Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Could we define series variables in one statement?

Hi, I am a new user of VBA in excel.

I want to know whether we can define a series variables in on
definition.

Such as:

Dim x(i) as integer

then, all the x(i), i=1,2,3.... is integer.

My situation is that I should copy several data in one file int
another file. If I copy the data one by one, it will take me a lo
time. Are there some methods that I can copy several data satisfyin
the condition to another file simulatenously.

my code is like these:

For i = 2 To 16

Workbooks.Open Filename:=DaSourceAfter & DaSourceFile 'open one file
Worksheets(1).Activate
totalvalue = Worksheets(1).Cells(i, 4).value
ActiveWorkbook.Close SaveChanges:=True

Workbooks.Open Filename:="D:\total\total.xls"
Worksheets(1).Activate
Worksheets(1).Cells(1, q) = DaSourceFile
Worksheets(1).Cells(p, q) = totalvalue

ActiveWorkbook.Close SaveChanges:=True
p = p + 1

Next i

Although I can copy the data to another file, it takes a lot time t
open and close the files. So I think that there should be some goo
method to improve the code. Could you tell me? Thanks

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default Could we define series variables in one statement?

Hi there;

Maybe I understood you wrong, but as I read your text, I yhink you don't
need it.
I can't find any x in your code so why use x(i).

When you use Dim i as integer, al i's from 2 to 16 al declared as integer.
This to me is so straightforward that I wonder if I missed something.

Mark.

--
More Excel ? www.rosenkrantz.nl or
-------------------------------------------------------------------


"Together " wrote in message
...
Hi, I am a new user of VBA in excel.

I want to know whether we can define a series variables in one
definition.

Such as:

Dim x(i) as integer

then, all the x(i), i=1,2,3.... is integer.

My situation is that I should copy several data in one file into
another file. If I copy the data one by one, it will take me a lot
time. Are there some methods that I can copy several data satisfying
the condition to another file simulatenously.

my code is like these:

For i = 2 To 16

Workbooks.Open Filename:=DaSourceAfter & DaSourceFile 'open one file
Worksheets(1).Activate
totalvalue = Worksheets(1).Cells(i, 4).value
ActiveWorkbook.Close SaveChanges:=True

Workbooks.Open Filename:="D:\total\total.xls"
Worksheets(1).Activate
Worksheets(1).Cells(1, q) = DaSourceFile
Worksheets(1).Cells(p, q) = totalvalue

ActiveWorkbook.Close SaveChanges:=True
p = p + 1

Next i

Although I can copy the data to another file, it takes a lot time to
open and close the files. So I think that there should be some good
method to improve the code. Could you tell me? Thanks.


---
Message posted from
http://www.ExcelForum.com/



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
define chart series from single column Maarten Excel Discussion (Misc queries) 2 May 24th 07 08:49 AM
define series in scatterplot from column Maarten Charts and Charting in Excel 0 April 18th 07 01:10 PM
Using a Variable to Define Series Posse John Charts and Charting in Excel 2 August 30th 06 01:18 PM
how do I define a chart series with an indirect reference tvanellen Charts and Charting in Excel 4 May 31st 06 10:52 AM
How do you define variables in excel? BigRon Excel Discussion (Misc queries) 6 April 16th 05 08:47 PM


All times are GMT +1. The time now is 03:29 PM.

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

About Us

"It's about Microsoft Excel"