#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 281
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default 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

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 281
Default 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

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default 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

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 281
Default 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



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default 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

  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default 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

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
Macro issue Farhad Excel Discussion (Misc queries) 5 December 21st 08 06:05 PM
MS Excel Macro issue msofficehelp Excel Discussion (Misc queries) 2 October 24th 08 01:12 AM
Macro issue Sue Excel Discussion (Misc queries) 0 October 8th 08 08:05 PM
Macro Issue basanth New Users to Excel 3 September 10th 08 06:05 PM
Easy macro issue (I think) punter Excel Discussion (Misc queries) 3 May 29th 06 03:17 PM


All times are GMT +1. The time now is 08:18 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"