![]() |
Macro issue 2
Hi all,
my problem is to know how can i activate the last tab of an excel file in my code i am openning several excel files one by one (not at the same time) in my code and need to activate the last tab of each of them when the file is open i am usung the code below which i found in MS Excel help but it doesn't work everyone help me please. ActiveWindow.ScrollWorkbookTabs Position:=xlLast thanks, -- Farhad Hodjat |
Macro issue 2
Once you have opened a workbook, it becomes the Active workbook. So:
Sub lastone() Sheets(Sheets.Count).Activate End Sub should work just fine -- Gary''s Student - gsnu200821 "Farhad" wrote: Hi all, my problem is to know how can i activate the last tab of an excel file in my code i am openning several excel files one by one (not at the same time) in my code and need to activate the last tab of each of them when the file is open i am usung the code below which i found in MS Excel help but it doesn't work everyone help me please. ActiveWindow.ScrollWorkbookTabs Position:=xlLast thanks, -- Farhad Hodjat |
Macro issue 2
You can use this: Code: -------------------- Sheets(Sheets.Count).Select -------------------- you can use Activate rahther than Select if you wish! -- Simon Lloyd Regards, Simon Lloyd 'The Code Cage' (http://www.thecodecage.com) ------------------------------------------------------------------------ Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1 View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=43199 |
Macro issue 2
Thanks Gary! it worked great
-- Farhad Hodjat "Gary''s Student" wrote: Once you have opened a workbook, it becomes the Active workbook. So: Sub lastone() Sheets(Sheets.Count).Activate End Sub should work just fine -- Gary''s Student - gsnu200821 "Farhad" wrote: Hi all, my problem is to know how can i activate the last tab of an excel file in my code i am openning several excel files one by one (not at the same time) in my code and need to activate the last tab of each of them when the file is open i am usung the code below which i found in MS Excel help but it doesn't work everyone help me please. ActiveWindow.ScrollWorkbookTabs Position:=xlLast thanks, -- Farhad Hodjat |
Macro issue 2
Thank you for the feedback!
-- Gary''s Student - gsnu200821 "Farhad" wrote: Thanks Gary! it worked great -- Farhad Hodjat "Gary''s Student" wrote: Once you have opened a workbook, it becomes the Active workbook. So: Sub lastone() Sheets(Sheets.Count).Activate End Sub should work just fine -- Gary''s Student - gsnu200821 "Farhad" wrote: Hi all, my problem is to know how can i activate the last tab of an excel file in my code i am openning several excel files one by one (not at the same time) in my code and need to activate the last tab of each of them when the file is open i am usung the code below which i found in MS Excel help but it doesn't work everyone help me please. ActiveWindow.ScrollWorkbookTabs Position:=xlLast thanks, -- Farhad Hodjat |
Macro issue 2
You're Welcome! i have another question how can i check a tab in a excel file
say tab "aaa" if it is exist in the file or not? sorry bugging you again i am very new in VBA and need to learn. Thanks, -- Farhad Hodjat "Gary''s Student" wrote: Thank you for the feedback! -- Gary''s Student - gsnu200821 "Farhad" wrote: Thanks Gary! it worked great -- Farhad Hodjat "Gary''s Student" wrote: Once you have opened a workbook, it becomes the Active workbook. So: Sub lastone() Sheets(Sheets.Count).Activate End Sub should work just fine -- Gary''s Student - gsnu200821 "Farhad" wrote: Hi all, my problem is to know how can i activate the last tab of an excel file in my code i am openning several excel files one by one (not at the same time) in my code and need to activate the last tab of each of them when the file is open i am usung the code below which i found in MS Excel help but it doesn't work everyone help me please. ActiveWindow.ScrollWorkbookTabs Position:=xlLast thanks, -- Farhad Hodjat |
Macro issue 2
Function SheetExists(SheetName As String) As Boolean
On Error Resume Next SheetExists = CBool(Len(ThisWorkbook.Worksheets(SheetName).Name) ) End Function so =sheetexists("aaa") will return True if the sheets exists. -- Gary''s Student - gsnu200821 "Farhad" wrote: You're Welcome! i have another question how can i check a tab in a excel file say tab "aaa" if it is exist in the file or not? sorry bugging you again i am very new in VBA and need to learn. Thanks, -- Farhad Hodjat "Gary''s Student" wrote: Thank you for the feedback! -- Gary''s Student - gsnu200821 "Farhad" wrote: Thanks Gary! it worked great -- Farhad Hodjat "Gary''s Student" wrote: Once you have opened a workbook, it becomes the Active workbook. So: Sub lastone() Sheets(Sheets.Count).Activate End Sub should work just fine -- Gary''s Student - gsnu200821 "Farhad" wrote: Hi all, my problem is to know how can i activate the last tab of an excel file in my code i am openning several excel files one by one (not at the same time) in my code and need to activate the last tab of each of them when the file is open i am usung the code below which i found in MS Excel help but it doesn't work everyone help me please. ActiveWindow.ScrollWorkbookTabs Position:=xlLast thanks, -- Farhad Hodjat |
All times are GMT +1. The time now is 08:45 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com