Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default MACRO QUESTION

Hello
I'm doing a macro that combines data from many files to one worksheet
master file. The problem is in the worksheet master file, when there are
data updated in one of those files it can't appear in the master worksheet
becos when recording of macro (copy & paste ) the range already fixed. How
can I solve this problem. Any help appreciated.
TQ
Nickie


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default MACRO QUESTION

when you copy your data, instead of using

ActiveSheet.Range("A1:Z20")

use
Activesheet.Range("A1").CurrentRegion

or
Activesheet.UsedRange

Currentregion assumes all you data is contiguous. You can test it by
selecting A1 and doing Ctrl+Shift+8 and see if it picks up all your data.
If it higlights all your data, then you can use currentregion.

A final alternative is to use

With ActiveSheet
set rng = .Range(.cells(1,1),.Cells(rows.count,1).End(xlup)) .Resize(,10)
End With
rng.Select

change the 10 to indicate the number of columns. This is dependent on there
being values in Column A, but you could change it to check another column
(although you would need to possibly add an offset to pick up all the
columns you want.

--
Regards,
Tom Ogilvy


"dkcipoh" wrote in message
...
Hello
I'm doing a macro that combines data from many files to one worksheet
master file. The problem is in the worksheet master file, when there are
data updated in one of those files it can't appear in the master worksheet
becos when recording of macro (copy & paste ) the range already fixed. How
can I solve this problem. Any help appreciated.
TQ
Nickie




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default MACRO QUESTION

Thanks it works...

"Tom Ogilvy" wrote in message
...
when you copy your data, instead of using

ActiveSheet.Range("A1:Z20")

use
Activesheet.Range("A1").CurrentRegion

or
Activesheet.UsedRange

Currentregion assumes all you data is contiguous. You can test it by
selecting A1 and doing Ctrl+Shift+8 and see if it picks up all your data.
If it higlights all your data, then you can use currentregion.

A final alternative is to use

With ActiveSheet
set rng = .Range(.cells(1,1),.Cells(rows.count,1).End(xlup)) .Resize(,10)
End With
rng.Select

change the 10 to indicate the number of columns. This is dependent on

there
being values in Column A, but you could change it to check another column
(although you would need to possibly add an offset to pick up all the
columns you want.

--
Regards,
Tom Ogilvy


"dkcipoh" wrote in message
...
Hello
I'm doing a macro that combines data from many files to one worksheet
master file. The problem is in the worksheet master file, when there are
data updated in one of those files it can't appear in the master

worksheet
becos when recording of macro (copy & paste ) the range already fixed.

How
can I solve this problem. Any help appreciated.
TQ
Nickie






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
Excel 2007 Macro/VB Question DDE Question MadDog22 Excel Worksheet Functions 1 March 10th 10 01:47 AM
macro question Oligo Excel Discussion (Misc queries) 4 March 21st 09 04:11 PM
Macro Question Carl Excel Worksheet Functions 0 August 28th 06 06:00 PM
question on macro Harry Excel Discussion (Misc queries) 8 April 13th 06 04:25 PM
Macro Question? Greg B Excel Discussion (Misc queries) 7 March 9th 05 01:08 PM


All times are GMT +1. The time now is 07:16 PM.

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"