"Expected: list separator or )" error

ausis

New Member
Joined
Jan 12, 2011
Messages
16
Hi, i keep receiving the error noted in the thread title and i'm really confused as to why. here is my code.

Range("F4").Select
For ror02 = 1 To Sheets.Count
x = Application.WorksheetFunction.VLookup(CDate("2/01/2002"), A1:F3000, 5, False)
y = Application.WorksheetFunction.VLookup(CDate("28/02/2002"), Sheet1, 5, False)
ActiveCell.Value = (y - x) / x
ActiveCell.Offset(1, 0).Activate
Next ror02

i am trying to run a loop, to collect data through multiple worksheets to do some short calculations and have it come up on a 'master' worksheet. hopefully the problem can be resolved, thanks in advance.
 
maybe it's to do with my workbook; i'll start fresh .. thanks for all the help though, much appreciated,

cheers
 
Upvote 0

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Don't give up. VBA and dates don't mix well. In a new workbook I entered 2/1/2002 in A1 and Hello in E1. This code failed with run-time error 1004:

Code:
Sub Test1()
    Dim x
    x = Application.WorksheetFunction.VLookup(CDate("2/01/2002"), Range("A1:F3000"), 5, False)
    MsgBox x
End Sub

But this code worked and returned Hello:

Code:
Sub Test2()
    Dim x
    x = Application.WorksheetFunction.VLookup(CLng(CDate("2/01/2002")), Range("A1:F3000"), 5, False)
    MsgBox x
End Sub

Do you get the same?
 
Upvote 0
hey thanks for persevering,

yes i have the same error, 1004 for test 1. test 2 works fine
 
Upvote 0
this is what i used, it's still shooting blanks

Range("c4").Select
Dim x
Dim y
On Error Resume Next
For rorj02 = 1 To Sheets.Count
x = Application.WorksheetFunction.VLookup(CLng(CDate("2/01/2002")), Range("A1:F3000"), 5, False)
y = Application.WorksheetFunction.VLookup(CLng(CDate("28/06/2002")), Range("A1:F3000"), 5, False)
ActiveCell.Value = (y - x) / x
ActiveCell.Offset(1, 0).Activate
Next rorj02

i'm using sheet 11 to execute the code, collecting data from the previous sheets. would that have an impact?
 
Last edited:
Upvote 0
On which sheet is your lookup table? Why are you looking up the same thing for the number of sheets in your workbook?
 
Upvote 0
the lookup tables are on sheets 1 - 10. each sheet represents a company and contains data about it's stock prices. so on the 11th sheet, i want to represent key information about each company, to compare them
 
Upvote 0
In that case you need to qualify the lookup range with its worksheet:

Rich (BB code):
x = Application.WorksheetFunction.VLookup(CLng(CDate("2/01/2002")), Worksheets(rorj02).Range("A1:F3000"), 5, False)
y = Application.WorksheetFunction.VLookup(CLng(CDate("28/06/2002")), Worksheets(rorj02).Range("A1:F3000"), 5, False)
 
Upvote 0
omg!! success! THANK YOU!!

and apologies to all the previous people who have made suggestions, i should have stated my situation clearer!

thank you!!
 
Upvote 0

Forum statistics

Threads
1,215,140
Messages
6,123,270
Members
449,093
Latest member
Vincent Khandagale

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top