PC Review


Reply
Thread Tools Rate Thread

Capture name of last worksheet opened

 
 
Sliman
Guest
Posts: n/a
 
      9th Aug 2007
I need to be able to run a macro when I open worksheet only if i
opened worksheet from a particual sheet.

if i open sheet 1 and was on sheet 2 i want macro in sheet 1 "on open"
to run
if i open sheet 1 and was on sheet 3 i want macrro in sheet 1 "on
open" no to run

 
Reply With Quote
 
 
 
 
=?Utf-8?B?VmVyZ2VsIEFkcmlhbm8=?=
Guest
Posts: n/a
 
      9th Aug 2007
something like this in the ThisWorkbook code module:


Dim strPreviousSheet As String
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
If Sh.Name = "Sheet1" And strPreviousSheet = "Sheet2" Then
'Call a sub defined in sheet1
Sheets(Sh.Name).test
End If
strPreviousSheet = Sh.Name
End Sub


--
Hope that helps.

Vergel Adriano


"Sliman" wrote:

> I need to be able to run a macro when I open worksheet only if i
> opened worksheet from a particual sheet.
>
> if i open sheet 1 and was on sheet 2 i want macro in sheet 1 "on open"
> to run
> if i open sheet 1 and was on sheet 3 i want macrro in sheet 1 "on
> open" no to run
>
>

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Protect Excel Worksheet to be opened on one PC only Fabian Microsoft Excel Misc 11 1st Sep 2009 09:58 PM
Capture a worksheet in VBA Madiya Microsoft Excel Programming 6 11th Aug 2006 03:40 PM
Run macro when worksheet is opened =?Utf-8?B?TUxU?= Microsoft Excel Programming 3 11th Jul 2005 06:13 PM
Add-In will not allow worksheet to be opened. =?Utf-8?B?Q2hhZA==?= Microsoft Excel Programming 3 7th Apr 2005 03:18 PM
Excel worksheet opened twice =?Utf-8?B?RGFuaXRhIFNpbW9u?= Microsoft Excel Misc 2 5th Nov 2004 10:01 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:59 PM.