Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have 2 files: FILE1 and FILE2
File1 has a 5 worksheets that begin with 101, 102, 103, 104 & 105 I need a code that if in FILE2 cell C14 there is a 101 and I'm in FILE worksheet 101 then it goes ahead and runs the rest of the macro, but i im in FILE1 , worksheet 102 and it sees a 101 in FILE2 then it stop and says WRONG FIL -- Message posted from http://www.ExcelForum.com |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
try something like the following sub foo() dim wbk_1 as workbook dim wbk_2 as workbook dim wks_1 as worksheet dim wks_2 as worksheet dim test_value set wbk_1 = workbooks("file1.xls") set wks_1 = wbk_1.activesheet set wbk_2 = workbooks("file2.xls") set wks_2 = wbk_2.worksheets("sheet1") test_value = wks_2.range("C14").value if lcase(wks_1.name) <lcase(test_value) then msgbox "wrong sheet" exit sub end if 'your code comes here end sub -- Regards Frank Kabel Frankfurt, Germany I have 2 files: FILE1 and FILE2 File1 has a 5 worksheets that begin with 101, 102, 103, 104 & 105 I need a code that if in FILE2 cell C14 there is a 101 and I'm in FILE1 worksheet 101 then it goes ahead and runs the rest of the macro, but if im in FILE1 , worksheet 102 and it sees a 101 in FILE2 then it stops and says WRONG FILE --- Message posted from http://www.ExcelForum.com/ |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks, you have me in the right direction... But, what if my workshee
is called 101NOW and 101-MAR How can I have it just check for the 101 in the worksheet name -- Message posted from http://www.ExcelForum.com |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
change the line if lcase(wks_1.name) <lcase(test_value) to if lcase(left(wks_1.name,3)) <lcase(test_value) -- Regards Frank Kabel Frankfurt, Germany Thanks, you have me in the right direction... But, what if my worksheet is called 101NOW and 101-MAR How can I have it just check for the 101 in the worksheet name? --- Message posted from http://www.ExcelForum.com/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
make a check form, and then have info go to a check register | Excel Worksheet Functions | |||
Copy and move check box (check boxes) with new cell link? | Excel Worksheet Functions | |||
Increase size of a Forms Check Box (click on to enter check mark) | Excel Discussion (Misc queries) | |||
Check if Conditional Format is True or False / Check cell Color | Excel Worksheet Functions | |||
Enable check box in protected sheet + group check boxes | Excel Discussion (Misc queries) |