Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 175
Default Do Until syntax problem

Can someone please tell me what is wrong with this command?

Do Until Range("Current_Date").Value - ActiveCell.Value < 361

I tried to add at the end,

Do Until Range("Current_Date").Value - ActiveCell.Value < 361 = True

but it still errors out.

Any suggestions? I've browsed examples here, and couldn't find anything
similar to what I'm doing.
Thanks,
J.O.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 46
Default Do Until syntax problem

The second form is wrong. The first form can be made clearer if you
include parentheses:
Do Until (Range("Current_Date").Value - ActiveCell.Value) < 361

But in either case it should not error out. Are you sure the range
"Current_Date" is correct? If not the error should be on the Range
Method, not the "Do" or "Until" statements.

Hope this gets you started,
Dom



excelnut1954 wrote:
Can someone please tell me what is wrong with this command?

Do Until Range("Current_Date").Value - ActiveCell.Value < 361

I tried to add at the end,

Do Until Range("Current_Date").Value - ActiveCell.Value < 361 = True

but it still errors out.

Any suggestions? I've browsed examples here, and couldn't find anything
similar to what I'm doing.
Thanks,
J.O.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Do Until syntax problem

of course I had a defined name Current_Date, it contained a date and it only
referenced a single cell.

--
Regards,
Tom Ogilvy



"excelnut1954" wrote:

Can someone please tell me what is wrong with this command?

Do Until Range("Current_Date").Value - ActiveCell.Value < 361

I tried to add at the end,

Do Until Range("Current_Date").Value - ActiveCell.Value < 361 = True

but it still errors out.

Any suggestions? I've browsed examples here, and couldn't find anything
similar to what I'm doing.
Thanks,
J.O.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Do Until syntax problem

Sub ABC()
Range("A3").Select

Do Until Range("Current_Date").Value - ActiveCell.Value < 361
ActiveCell.Offset(1, 0).Select
Loop
End Sub

worked fine for me. It stopped on 10/25/2005

--
Regards,
Tom Ogilvy



"excelnut1954" wrote:

Can someone please tell me what is wrong with this command?

Do Until Range("Current_Date").Value - ActiveCell.Value < 361

I tried to add at the end,

Do Until Range("Current_Date").Value - ActiveCell.Value < 361 = True

but it still errors out.

Any suggestions? I've browsed examples here, and couldn't find anything
similar to what I'm doing.
Thanks,
J.O.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 175
Default Do Until syntax problem

Thanks for the responses. What I'm getting is a Type Mis Match error.
What I was trying to do is to replace this line
Do Until IsEmpty(ActiveCell.Value)
with the one I have above. I inserted a line to sort the list by date,
with the older records at the top. I was just trying to see if I could
save a bit of time having it read only part of the list, instead of
having to read all the 600 records.

Anyway, the original works fine. So, I don't want to spend too much
time on it.
At this point, I'm more interested in why it didn't work, for future
reference. I haven't yet put equations in any of my Do Until commands,
so I thought I had the syntax wrong. Obviously there's something else
at play on why the original line works ok in the macro, but not the new
line.
Thanks
J.O.
Tom Ogilvy wrote:
Sub ABC()
Range("A3").Select

Do Until Range("Current_Date").Value - ActiveCell.Value < 361
ActiveCell.Offset(1, 0).Select
Loop
End Sub

worked fine for me. It stopped on 10/25/2005

--
Regards,
Tom Ogilvy



"excelnut1954" wrote:

Can someone please tell me what is wrong with this command?

Do Until Range("Current_Date").Value - ActiveCell.Value < 361

I tried to add at the end,

Do Until Range("Current_Date").Value - ActiveCell.Value < 361 = True

but it still errors out.

Any suggestions? I've browsed examples here, and couldn't find anything
similar to what I'm doing.
Thanks,
J.O.





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Do Until syntax problem

Since you only originally posted 1 line of code and now one more, it would
be hard to say.

Perhaps the activecell doesn't contain a number or date when you have the
error.

--
Regards,
Tom Ogilvy


"excelnut1954" wrote in message
oups.com...
Thanks for the responses. What I'm getting is a Type Mis Match error.
What I was trying to do is to replace this line
Do Until IsEmpty(ActiveCell.Value)
with the one I have above. I inserted a line to sort the list by date,
with the older records at the top. I was just trying to see if I could
save a bit of time having it read only part of the list, instead of
having to read all the 600 records.

Anyway, the original works fine. So, I don't want to spend too much
time on it.
At this point, I'm more interested in why it didn't work, for future
reference. I haven't yet put equations in any of my Do Until commands,
so I thought I had the syntax wrong. Obviously there's something else
at play on why the original line works ok in the macro, but not the new
line.
Thanks
J.O.
Tom Ogilvy wrote:
Sub ABC()
Range("A3").Select

Do Until Range("Current_Date").Value - ActiveCell.Value < 361
ActiveCell.Offset(1, 0).Select
Loop
End Sub

worked fine for me. It stopped on 10/25/2005

--
Regards,
Tom Ogilvy



"excelnut1954" wrote:

Can someone please tell me what is wrong with this command?

Do Until Range("Current_Date").Value - ActiveCell.Value < 361

I tried to add at the end,

Do Until Range("Current_Date").Value - ActiveCell.Value < 361 = True

but it still errors out.

Any suggestions? I've browsed examples here, and couldn't find anything
similar to what I'm doing.
Thanks,
J.O.





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
syntax problem dorre Excel Programming 3 March 20th 06 05:20 PM
Syntax problem unknowndevice[_4_] Excel Programming 4 August 26th 05 10:57 PM
Syntax problem Alex H Excel Worksheet Functions 1 July 2nd 05 08:23 AM
Another Syntax Problem Sharlene England Excel Programming 2 December 2nd 03 10:04 PM


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