Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 430
Default Compile error HELP

Trying to understand more about arrays,,
I have values in cells A11:A19, so when I run:

Sub CreateAnArray()
Dim MyArray(9) As Long
Dim i As Integer
Dim R As Range
i = 0
Set R = Range("A11:A19")
For Each c In R
MyArray(i).Value = c.Value ' Bombing Here Compile error!!
i = i + 1
Next c
End Sub


WHY?
Thanks,,


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Compile error HELP

Option Explicit
Sub CreateAnArray()
Dim MyArray(9) As Long
Dim i As Integer
Dim R As Range
Dim C As Range
i = 0
Set R = Range("A11:A19")
For Each C In R
MyArray(i) = C.Value ' Bombing Here Compile error!!
i = i + 1
Next C
End Sub



Jim May wrote:

Trying to understand more about arrays,,
I have values in cells A11:A19, so when I run:

Sub CreateAnArray()
Dim MyArray(9) As Long
Dim i As Integer
Dim R As Range
i = 0
Set R = Range("A11:A19")
For Each c In R
MyArray(i).Value = c.Value ' Bombing Here Compile error!!
i = i + 1
Next c
End Sub

WHY?
Thanks,,


--

Dave Peterson
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
help with this error-Compile error: cant find project or library JackR Excel Discussion (Misc queries) 2 June 10th 06 09:09 PM
VBAProject name compile error, not defined at compile time Matthew Dodds Excel Programming 1 December 13th 05 07:17 PM
error message: compile error, argument not optional Pierre via OfficeKB.com Excel Programming 3 September 5th 05 03:45 PM
How do I get rid of "Compile error in hidden module" error message David Excel Discussion (Misc queries) 4 January 21st 05 11:39 PM


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