Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Jump to next sheet if not found


Hello,


I'm trying to program a search the content of certain cells of tw
different sheets. When click on a button, program asks fo
RUN-nr...(=cellRun)
Then program has to search first in sheet one, when finding an empt
cell, the same search in sheet2. On the active cell, I run an othe
adjust program.


-Worksheets("sheet1").Activate
Range("C11:C12").Activate
Do While cellRun < ActiveCell
ActiveCell.Offset(rowOffset:=24).Activate
If IsEmpty(ActiveCell) Then
Exit Do
End If
Loop-

Now my problem: If I work with a DO LOOP in a Do Loop, the progra
isn't working.


several attempts didn't work...I'm not willing to give up trying...bu
a little tip is always welcome

--
Zur
-----------------------------------------------------------------------
Zurn's Profile: http://www.excelforum.com/member.php...fo&userid=1464
View this thread: http://www.excelforum.com/showthread.php?threadid=26412

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Jump to next sheet if not found

Dim sh1 as Worksheet, sh2 as Worksheet
Dim i as long, bFound as Boolean
bFound = False
set sh1 = Worksheets("Sheet1")
set sh2 = worksheets("Sheet2")
for i = 11 to 203 step 24
if isempty(sh.Cells(i,3)) then exit for
if sh1.Cells(i,3) = cellrun then
sh1.Activate
cells(i,3).Select
bfound = True
exit for
elseif sh1.Cells(i+1,3) = cellrun then
sh1.Activate
cells(i+1,3).Select
bFound = True
exit for
end if
Next
if not bFound then
for i = 11 to 203 step 24
if isempty(sh2.Cells(i,3)) then exit for
if sh.Cells(i,3) = cellrun then
sh2.Activate
cells(i,3).Select
bfound = True
exit for
elseif sh2.Cells(i+1,3) = cellrun then
sh.Activate
cells(i+1,3).Select
bFound = True
exit for
end if
Next
End if

if not bFound then
msgbox "Not found"
exit sub
End if


--
Regards,
Tom Ogilvy

"Zurn" wrote in message
...

Hello,


I'm trying to program a search the content of certain cells of two
different sheets. When click on a button, program asks for
RUN-nr...(=cellRun)
Then program has to search first in sheet one, when finding an empty
cell, the same search in sheet2. On the active cell, I run an other
adjust program.


-Worksheets("sheet1").Activate
Range("C11:C12").Activate
Do While cellRun < ActiveCell
ActiveCell.Offset(rowOffset:=24).Activate
If IsEmpty(ActiveCell) Then
Exit Do
End If
Loop-

Now my problem: If I work with a DO LOOP in a Do Loop, the program
isn't working.


several attempts didn't work...I'm not willing to give up trying...but
a little tip is always welcome.


--
Zurn
------------------------------------------------------------------------
Zurn's Profile:

http://www.excelforum.com/member.php...o&userid=14645
View this thread: http://www.excelforum.com/showthread...hreadid=264122



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
I want to jump to a worksheet from a contents sheet John C Excel Worksheet Functions 2 June 6th 06 05:11 PM
macro that can jump to a sheet... beatrice25 Excel Discussion (Misc queries) 2 May 18th 06 12:11 AM
Jump to Sheet Dropdown List Mike Excel Worksheet Functions 1 August 9th 05 09:59 PM
How do I create a command button to jump from sheet to sheet in a. Darlenew Excel Worksheet Functions 3 March 22nd 05 10:36 PM
Macro to jump from the find box to found item Todd[_9_] Excel Programming 14 October 17th 03 08:04 PM


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