Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
I want to jump to a worksheet from a contents sheet | Excel Worksheet Functions | |||
macro that can jump to a sheet... | Excel Discussion (Misc queries) | |||
Jump to Sheet Dropdown List | Excel Worksheet Functions | |||
How do I create a command button to jump from sheet to sheet in a. | Excel Worksheet Functions | |||
Macro to jump from the find box to found item | Excel Programming |