Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Stuck on a validation loop

Hi all,

It's been a few years since I've done any kind of VB programming (or any
programming for that matter), but I am trying to automate a reporting
process that I have to do every morning as part of my job.

What I am trying to achieve is to get the contents of a cell on one sheet
of a workbook (after importing data), check it against a cell on another
sheet, repeat the process for another cell but then make sure that the 2
cells that have been found are on the same row.

So at the moment it's something along these lines:

celldate = Worksheets("Sheet1").Cells(currentrow, currentcolumn)
MsgBox (celldate)

founddate = Worksheets("Primes & Outlets").Cells.Find(celldate)
MsgBox (founddate)

If founddate = celldate Then verifieddate = True

And the same goes for checking the 'day' as well.

The only problem being is that whereas there is only 1 01-FEB-05, there
are many THURSDAY(s). So what I want to do is check to make sure
something like founddate.Row = foundday.Row.

Having not written any code in such a long time I'm having difficulty
getting the syntax right for what I need to do...which is:

if foundday.Row < founddate.Row then
foundday = .FindNext(day)
until
foundday.Row = founddate.Row
EndIf

....or something like that, like I said, I've not done this for years.

Hope one of you can help
--
Stu


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Stuck on a validation loop

Your description is lacking in the kind of detail necessary to provide a
focused solution, so in general.

Dim sStr as variant
Dim rng as Range
Dim fAddr as String
Dim fndcell as Range

sStr = "something"

set rng = Worksheets(1).Cells.Find(sStr)
if not rng is nothing then
fAddr = rng.Address
do
if rng.Value = "???" then ' test your condition
' condition met, save results and exit loop
set fndcell = rng
exit do
end if
set rng = worksheets(1).Cells.FindNext(rng)
Loop while rng.Address < fAddr
End if

msgbox fndcell.Address

--
Regards,
Tom Ogilvy


"Stuart Luscombe" wrote in message
.251...
Hi all,

It's been a few years since I've done any kind of VB programming (or any
programming for that matter), but I am trying to automate a reporting
process that I have to do every morning as part of my job.

What I am trying to achieve is to get the contents of a cell on one sheet
of a workbook (after importing data), check it against a cell on another
sheet, repeat the process for another cell but then make sure that the 2
cells that have been found are on the same row.

So at the moment it's something along these lines:

celldate = Worksheets("Sheet1").Cells(currentrow, currentcolumn)
MsgBox (celldate)

founddate = Worksheets("Primes & Outlets").Cells.Find(celldate)
MsgBox (founddate)

If founddate = celldate Then verifieddate = True

And the same goes for checking the 'day' as well.

The only problem being is that whereas there is only 1 01-FEB-05, there
are many THURSDAY(s). So what I want to do is check to make sure
something like founddate.Row = foundday.Row.

Having not written any code in such a long time I'm having difficulty
getting the syntax right for what I need to do...which is:

if foundday.Row < founddate.Row then
foundday = .FindNext(day)
until
foundday.Row = founddate.Row
EndIf

...or something like that, like I said, I've not done this for years.

Hope one of you can help
--
Stu




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
stuck in an error loop Darla Excel Discussion (Misc queries) 1 January 8th 10 06:06 PM
Stuck in a Sub Loop robzrob Excel Worksheet Functions 4 July 19th 08 11:53 PM
Excel with game is stuck in a loop [email protected] Excel Discussion (Misc queries) 2 December 19th 06 08:11 PM
Stuck in a loop CWillis Excel Discussion (Misc queries) 2 June 5th 06 02:49 PM
Limit search range then loop thru' each cell...a bit stuck... ste mac Excel Programming 1 December 17th 04 01:35 PM


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