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: 5
Default Variable results to new workbook

I have managed to get the below code working perfect. But for the life
of me I can not figure out how to get the results into a new workbook.

The line "Debug.Print i, myNumbers(i)" sends it to the imediate window
but I need it to go to a new workbook.

Another thing I would like to do is prompt for the file names. These
should be easy but I am stumped!!

Thanks!!
Fred

-----------
Sub compare()
Dim i As Long
Dim myNumbers()
ReDim myNumbers(1 To 1)

With Workbooks("work1.xls").Sheets("Sheet1")
Set rng1 = .Range(.Range("A2"), .Range("A2").End(xlDown))
End With


With Workbooks("work2.xls").Sheets("Sheet1")
Set rng2 = .Range(.Range("A2"), .Range("A2").End(xlDown))
End With

i = 1
For Each cell In rng1
res = Application.Match(cell.Value, rng2, 0)
If IsError(res) Then
myNumbers(i) = cell.Value
i = i + 1
ReDim Preserve myNumbers(1 To i)
End If
Next
ReDim Preserve myNumbers(1 To i - 1)

For i = LBound(myNumbers) To UBound(myNumbers)


Debug.Print i, myNumbers(i)

Next i

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
Analysis of measured test results by INTERVAL (variable) Tom Excel Discussion (Misc queries) 2 February 11th 09 12:50 AM
provide simultaneous results for a range of a particular variable [email protected] Excel Discussion (Misc queries) 2 December 29th 06 01:14 AM
Record macro and obtain variable range results? Pierre Excel Discussion (Misc queries) 2 August 18th 06 07:03 PM
Define drop-down results that are variable and dependent upon the. 33zenlane Excel Discussion (Misc queries) 4 December 13th 05 09:42 PM
Variable for workbook name Mervyn Thomas Excel Programming 2 September 8th 04 12:22 PM


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