Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
stuck in an error loop | Excel Discussion (Misc queries) | |||
Stuck in a Sub Loop | Excel Worksheet Functions | |||
Excel with game is stuck in a loop | Excel Discussion (Misc queries) | |||
Stuck in a loop | Excel Discussion (Misc queries) | |||
Limit search range then loop thru' each cell...a bit stuck... | Excel Programming |