LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 93
Default Dynamic Array

This little program reads some date from one row on a sheet in a
workbook, then goes to another wb and inserts a sheet and pastes the
data then goes back to the first wb/sheet and loops till it's out of
data. I know all the data could be read at once and then all the
pasting done with a dynamic array but I haven't been able to make that
work. "DataTable.xls" will be a new file each day hence the need for a
dynamic array to read the data. Any help would be greatly appreciated.


Public Sub RunReports()

Dim vManagers As Range, vManager As Range
Dim DataArray(5)

Windows("DataTable.xls").Activate

On Error Resume Next
Set vManagers = Range("D:D")
On Error GoTo 0
If Not vManagers Is Nothing Then
For Each vManager In vManagers

If vManager.Value = "S. O' Neil" Then

vManager.Activate
DataArray(1) = ActiveCell.Offset(0, -3) 'Date
DataArray(2) = ActiveCell.Offset(0, -1) 'Borrower
Name
DataArray(3) = ActiveCell.Offset(0, 1) 'Retail/
Broker
DataArray(4) = ActiveCell.Offset(0, 3) 'Loan
Number
DataArray(5) = ActiveCell.Offset(0, 7) 'Amount
Windows("Check Deposit Report.xls").Activate
Sheets("CHECK-DEPOSIT").Copy After:=Sheets(1)
ActiveSheet.Unprotect
Range("F43").Value = DataArray(1)
Range("B43").Value = DataArray(2)
If DataArray(3) = "Broker" Then
Range("F32").Value = DataArray(3)
Else
Range("F32").Value = "Retail"
End If
Range("A43").Value = DataArray(4)
Range("I27").Value = -DataArray(5)
Windows("DataTable.xls").Activate
End If
Next
End If

Windows("Check Deposit Report.xls").Activate

End Sub
 
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
Speed of fixed array versus dynamic array Sing Excel Programming 8 November 18th 07 10:19 AM
Dynamic Array Lbound not working when only one value in array [email protected] Excel Programming 3 May 25th 07 04:08 AM
Dynamic array [email protected] Excel Programming 1 February 5th 07 10:41 PM
Dynamic 2D Array ExcelMonkey[_52_] Excel Programming 4 January 31st 04 09:32 PM
Dynamic Array dan Excel Programming 4 January 27th 04 04:16 PM


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