Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Macro to copy and paste values (columns)I have a macro file built

I have a macro file built over time from seeking expert advice from this
forum and that explains my limit knowledge on VBA. The macro opens 10 excel
files and the last file (call this master file) fetches data from the
previous files. The macro then does some proven routine and closes all the
files. Please note that the macro reside in a separate excel file.

I need help on this. In the master file I need to copy and paste values from
column A to column N and column AA to column AZ for multiple sheets (say
sheet1, sheet2€¦..sheetN). Can someone help?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 421
Default Macro to copy and paste values (columns)I have a macro file built

Hi CO2CO4,

In a standard module try something like:

'=========
Option Explicit

Public Sub tester()
Dim WB As Workbook
Dim SH As Worksheet
Dim rNG As Range
Dim arr As Variant
Dim CalcMode As Long
Const sAddress As String = "A:N, AA:AZ" '<<==== CHANGE

Set WB = Workbooks("MyBook.xls") '<<==== CHANGE
arr = VBA.Array("Sheet1", _
"Sheet2", _
"Sheet7") '<<====
CHANGE

On Error GoTo XIT
With Application
.ScreenUpdating = False
CalcMode = .Calculation
.Calculation = xlCalculationManual
End With
For Each SH In WB.Sheets(arr)
With SH
Set rNG = Application.Intersect _
(.Range(sAddress), .UsedRange)
End With

With rNG
.Value = .Value
End With
Next SH

XIT:
With Application
.ScreenUpdating = True
.Calculation = CalcMode
End With

End Sub
'<<=========



---
Regards.
Norman

"C02C04" wrote in message
...
I have a macro file built over time from seeking expert advice from this
forum and that explains my limit knowledge on VBA. The macro opens 10
excel
files and the last file (call this master file) fetches data from the
previous files. The macro then does some proven routine and closes all the
files. Please note that the macro reside in a separate excel file.

I need help on this. In the master file I need to copy and paste values
from
column A to column N and column AA to column AZ for multiple sheets (say
sheet1, sheet2€¦..sheetN). Can someone help?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Macro to copy and paste values (columns)I have a macro file bu

Thanks Norman for your super fast solution. I'll give it a try.

"Norman Jones" wrote:

Hi CO2CO4,

In a standard module try something like:

'=========
Option Explicit

Public Sub tester()
Dim WB As Workbook
Dim SH As Worksheet
Dim rNG As Range
Dim arr As Variant
Dim CalcMode As Long
Const sAddress As String = "A:N, AA:AZ" '<<==== CHANGE

Set WB = Workbooks("MyBook.xls") '<<==== CHANGE
arr = VBA.Array("Sheet1", _
"Sheet2", _
"Sheet7") '<<====
CHANGE

On Error GoTo XIT
With Application
.ScreenUpdating = False
CalcMode = .Calculation
.Calculation = xlCalculationManual
End With
For Each SH In WB.Sheets(arr)
With SH
Set rNG = Application.Intersect _
(.Range(sAddress), .UsedRange)
End With

With rNG
.Value = .Value
End With
Next SH

XIT:
With Application
.ScreenUpdating = True
.Calculation = CalcMode
End With

End Sub
'<<=========



---
Regards.
Norman

"C02C04" wrote in message
...
I have a macro file built over time from seeking expert advice from this
forum and that explains my limit knowledge on VBA. The macro opens 10
excel
files and the last file (call this master file) fetches data from the
previous files. The macro then does some proven routine and closes all the
files. Please note that the macro reside in a separate excel file.

I need help on this. In the master file I need to copy and paste values
from
column A to column N and column AA to column AZ for multiple sheets (say
sheet1, sheet2€¦..sheetN). Can someone help?



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
copy paste values macro Wanna Learn Excel Discussion (Misc queries) 5 July 21st 09 04:44 PM
Copy and Paste distinct columns macro mopgcw Excel Discussion (Misc queries) 2 November 3rd 08 11:04 PM
Macro for copy and paste values excelnerd Excel Discussion (Misc queries) 3 March 8th 08 06:51 PM
copy multiple worksheets of a workbook, and paste onto a Word document ( either create new doc file or paste onto an existing file.) I need this done by VBA, Excel Macro Steven Excel Programming 1 October 17th 05 08:56 AM
Copy & Paste values macro...almost there? ste mac Excel Programming 5 November 2nd 03 10:49 PM


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