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: 11
Default Save Array in memory

Hi NG

I'm using bellowed macro.



Each time I'm opening my User Form = UF, I must rum this macro for getting
array: data()



Is there a way I can load the Array [data()] in memory, so I only run the
macro when opening the file and Erase data() when closing the file?






Option Explicit

Public Const Delim As String = " ¿ "
Public Const hil As String = "Best regards from Joergen"

'// Array for form
Public data() As Variant

'----------------------------------------------------------
' Procedure : Form
' Date : 20110227
' Author : Joergen Bondesen
' Modifyed by :
' Purpose :
' Note :
'----------------------------------------------------------
'
Sub Form()
Dim sh As Worksheet
Set sh = Sheets(2)

Dim RRange As Range
Set RRange = sh.Range("A1:A" & _
sh.Cells(sh.Rows.Count, 1).End(xlUp).Row)

Dim Countarr As Long
Countarr = 0

Dim cell As Range
For Each cell In RRange
Dim Uniqs As New Collection
On Error Resume Next
Uniqs.Add cell.Value, CStr(cell.Value)
If Err = 0 Then
Countarr = Countarr + 1
ReDim Preserve data(1 To Countarr)
data(Countarr) = cell.Value & Delim _
& cell.Offset(0, 1) & Delim & cell.Offset(0, 2)
End If
On Error GoTo 0
Next cell

Load UF
UF.Show

Set sh = Nothing
Set RRange = Nothing
End Sub


--
Best Regards
Joergen Bondesen



 
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
(reposting) Memory problem: Out of Memory and cannot save WHA Excel Programming 0 November 30th 07 05:09 PM
Memory problem: Out of Memory and cannot save WHA Excel Programming 0 November 30th 07 03:52 AM
array storage in memory Albert Excel Programming 1 November 19th 06 12:47 AM
Out of Memory: Array Transpose TheVisionThing Excel Programming 10 May 1st 05 08:47 PM
Excel: Array & Memory EG[_2_] Excel Programming 0 September 1st 03 05:29 PM


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