Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
Scott
 
Posts: n/a
Default Array Problem

I am having trouble with this program and I think it is something minor...It
scans the first column in the sheet "Data" and returns unique values to be
stored in an array "PlayerNum".


Private Sub CommandButton1_Click()
Dim PlayerNum() As Variant
Dim x As Integer
Dim i As Integer

ChDir "C:\Documents and Settings\Scott Miller\My Documents\Handicap"
Workbooks.Open Filename:= _
"C:\Documents and Settings\Scott Miller\My
Documents\Handicap\Data.xls"
Range("A1").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Windows("Handicap.xls").Activate
Range("A1").Select
ActiveSheet.Paste
Windows("Data.xls").Activate
ActiveWindow.Close
Windows("Handicap.xls").Activate
Sheets("Data").Select

x = 3
i = 1
PlayerNum(i).Value = Sheets("Data").Cells(2, 1).Value

Do
Sheets("Data").Cells(x, 1).Select
If ActiveCell.Value = PlayerNum(i).Value Then
x = x + 1
Else
i = i + 1
ReDim Preserve PlayerNum(i) As Variant
PlayerNum(i).Value = ActiveCell.Value
End If

Loop Until Cells(x, 1).Value = ""


End Sub

Scott Miller
University of Washington
Chemistry
 
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
Array Formula Not Working with Range with Formulas [email protected] Excel Discussion (Misc queries) 4 February 1st 06 02:01 PM
Array Brad Excel Worksheet Functions 9 October 17th 05 09:00 PM
Sumproduct / Max array formula problem Andibevan Excel Worksheet Functions 5 August 25th 05 01:18 AM
Problem with array and msgbox aking1987 Excel Worksheet Functions 0 November 1st 04 08:57 AM
Problem with array and msgbox aking1987 Excel Worksheet Functions 1 October 29th 04 01:57 PM


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